mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <zanussi@kernel.org>,
	tglx@linutronix.de, namhyung@kernel.org, bigeasy@linutronix.de,
	joel@joelfernandes.org, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org
Subject: Re: [RFC PATCH 4/7] tracing/probe: Check event/group naming rule at parsing
Date: Thu, 14 Mar 2019 00:04:02 +0900	[thread overview]
Message-ID: <20190314000402.3b14693f9030e891648124f1@kernel.org> (raw)
In-Reply-To: <20190313092355.6f434c9f@gandalf.local.home>

On Wed, 13 Mar 2019 09:23:55 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed, 13 Mar 2019 21:28:12 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Check event and group naming rule at parsing it instead
> > of allocating probes.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  kernel/trace/trace_kprobe.c |    7 +------
> >  kernel/trace/trace_probe.c  |    8 ++++++++
> >  kernel/trace/trace_uprobe.c |    5 +----
> >  3 files changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> > index d47e12596f12..5222fd82e7e4 100644
> > --- a/kernel/trace/trace_kprobe.c
> > +++ b/kernel/trace/trace_kprobe.c
> > @@ -221,7 +221,7 @@ static struct trace_kprobe *alloc_trace_kprobe(const char *group,
> >  
> >  	tk->rp.maxactive = maxactive;
> >  
> > -	if (!event || !is_good_name(event)) {
> > +	if (!event || !group) {
> >  		ret = -EINVAL;
> >  		goto error;
> >  	}
> > @@ -231,11 +231,6 @@ static struct trace_kprobe *alloc_trace_kprobe(const char *group,
> >  	if (!tk->tp.call.name)
> >  		goto error;
> >  
> > -	if (!group || !is_good_name(group)) {
> > -		ret = -EINVAL;
> > -		goto error;
> > -	}
> > -
> >  	tk->tp.class.system = kstrdup(group, GFP_KERNEL);
> >  	if (!tk->tp.class.system)
> >  		goto error;
> > diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> > index feae03056f0b..1f0cb4030c0b 100644
> > --- a/kernel/trace/trace_probe.c
> > +++ b/kernel/trace/trace_probe.c
> > @@ -172,6 +172,10 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
> >  			return -E2BIG;
> >  		}
> >  		strlcpy(buf, event, slash - event + 1);
> > +		if (!is_good_name(buf)) {
> > +			pr_info("Group name must follow the rule of C identifier\n");
> 
> What do you mean by "C identifier"?

I meant "the naming rules of C language identifiers". It means
that the name has to start with alphabet or "_" and only contain
alphanumeric characters and "_". Does it clear?
I couldn't think of a good word. maybe "naming convention"
does not fit...

Would you have any idea?

Thank you,

> 
> -- Steve
> 
> > +			return -EINVAL;
> > +		}
> >  		*pgroup = buf;
> >  		*pevent = slash + 1;
> >  		event = *pevent;
> > @@ -184,6 +188,10 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
> >  		pr_info("Event name is too long\n");
> >  		return -E2BIG;
> >  	}
> > +	if (!is_good_name(event)) {
> > +		pr_info("Event name must follow the rule of C identifier\n");
> > +		return -EINVAL;
> > +	}
> >  	return 0;
> >  }
> >


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2019-03-13 15:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 12:27 [RFC PATCH 0/7] tracing: Use common error_log with probe events Masami Hiramatsu
2019-03-13 12:27 ` [RFC PATCH 1/7] tracing/probe: Check maxactive error cases Masami Hiramatsu
2019-03-13 13:20   ` Steven Rostedt
2019-03-13 14:37     ` Masami Hiramatsu
2019-03-13 14:51       ` Steven Rostedt
2019-03-13 22:43         ` Masami Hiramatsu
2019-03-13 12:27 ` [RFC PATCH 2/7] tracing/probe: Check event name length correctly Masami Hiramatsu
2019-03-13 12:28 ` [RFC PATCH 3/7] tracing/probe: Check the size of argument name and body Masami Hiramatsu
2019-03-13 12:28 ` [RFC PATCH 4/7] tracing/probe: Check event/group naming rule at parsing Masami Hiramatsu
2019-03-13 13:23   ` Steven Rostedt
2019-03-13 15:04     ` Masami Hiramatsu [this message]
2019-03-13 15:23       ` Steven Rostedt
2019-03-13 22:47         ` Masami Hiramatsu
2019-03-13 12:28 ` [RFC PATCH 5/7] tracing/probe: Verify alloc_trace_*probe() result Masami Hiramatsu
2019-03-13 12:28 ` [RFC PATCH 6/7] tracing: Use tracing error_log with probe events Masami Hiramatsu
2019-03-13 12:28 ` [RFC PATCH 7/7] selftests/ftrace: Add error_log testcase for kprobe errors Masami Hiramatsu
2019-03-13 20:15 ` [RFC PATCH 0/7] tracing: Use common error_log with probe events Tom Zanussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190314000402.3b14693f9030e891648124f1@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=zanussi@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome