From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75884C433E7 for ; Sat, 10 Oct 2020 23:06:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E0522067C for ; Sat, 10 Oct 2020 23:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602371217; bh=l40I3V9XZsVpiqUpsyzie5lpeXH9YHQ/A9SSooKOE38=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=X00YLRqZXkFRV9ERb3UzR3CQHthaYp3rAUQLYsc0Cy2P0SDzpwqkcbWVqqRzKGHiJ nZuWAL9gjEwfBUChnNricF+RK5SlbBJSgCWt6liQt/so3CS0oxYmsk85qQuN7008gX wQ1zmyP+raddzbUDKMsQ/XtksPxvcVYjp8NKTfyk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731961AbgJJW7F (ORCPT ); Sat, 10 Oct 2020 18:59:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:57024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731597AbgJJTyJ (ORCPT ); Sat, 10 Oct 2020 15:54:09 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DBF5B222C8; Sat, 10 Oct 2020 14:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602340920; bh=l40I3V9XZsVpiqUpsyzie5lpeXH9YHQ/A9SSooKOE38=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FcDoGORY7C8dbkfPBEa5qwYvtlJ4uii9AQh0nCym4DrzydFDk9AxokWTYEIBK/TDM OPaHWrTB6ZDg+M+8GvT2xDmNMdS7Rp2yZL3Hoyi0spg5vzN2B+k3eIsAWNyx/Hb9/u n9iJCbo+qIUZYF9/WmpfeeZHhg7l+R4SiIlREB2E= Date: Sat, 10 Oct 2020 23:41:56 +0900 From: Masami Hiramatsu To: Tom Zanussi Cc: rostedt@goodmis.org, axelrasmussen@google.com, mhiramat@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] tracing: Check that the synthetic event and field names are legal Message-Id: <20201010234156.61a8743510a05878ccfda0bf@kernel.org> In-Reply-To: <82b1b533c54f83bb7cd466a32244533717c8f291.1602255803.git.zanussi@kernel.org> References: <82b1b533c54f83bb7cd466a32244533717c8f291.1602255803.git.zanussi@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 9 Oct 2020 10:17:09 -0500 Tom Zanussi wrote: > Call the is_good_name() function used by probe events to make sure > synthetic event and field names don't contain illegal characters and > cause unexpected parsing of synthetic event commands. > I've tested it. This looks good to me. /sys/kernel/debug/tracing # echo "myevent char str]" >> synthetic_events sh: write error: Invalid argument /sys/kernel/debug/tracing # echo "myevent char str;[]" >> synthetic_events sh: write error: Invalid argument It works correctly now :) Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Thanks! > Fixes: 4b147936fa50 (tracing: Add support for 'synthetic' events) > Reported-by: Masami Hiramatsu > Signed-off-by: Tom Zanussi > --- > kernel/trace/trace_events_synth.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c > index b19e2f4159ab..8c9d6e464da0 100644 > --- a/kernel/trace/trace_events_synth.c > +++ b/kernel/trace/trace_events_synth.c > @@ -572,6 +572,10 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, > ret = -ENOMEM; > goto free; > } > + if (!is_good_name(field->name)) { > + ret = -EINVAL; > + goto free; > + } > > if (field_type[0] == ';') > field_type++; > @@ -1112,6 +1116,11 @@ static int __create_synth_event(int argc, const char *name, const char **argv) > > mutex_lock(&event_mutex); > > + if (!is_good_name(name)) { > + ret = -EINVAL; > + goto out; > + } > + > event = find_synth_event(name); > if (event) { > ret = -EEXIST; > -- > 2.17.1 > -- Masami Hiramatsu