All of lore.kernel.org
 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 1/7] tracing/probe: Check maxactive error cases
Date: Wed, 13 Mar 2019 23:37:39 +0900	[thread overview]
Message-ID: <20190313233739.09f58a0c5762d9a43470046b@kernel.org> (raw)
In-Reply-To: <20190313092051.77d04675@gandalf.local.home>

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

> On Wed, 13 Mar 2019 21:27:42 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Check maxactive on kprobe error case, because maxactive
> > is only for kretprobe, not for kprobe. Also, maxactive
> > should not be 0, it should be at least 1.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  kernel/trace/trace_kprobe.c |   10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> > index d5fb09ebba8b..d47e12596f12 100644
> > --- a/kernel/trace/trace_kprobe.c
> > +++ b/kernel/trace/trace_kprobe.c
> > @@ -624,7 +624,11 @@ static int trace_kprobe_create(int argc, const char *argv[])
> >  	if (event)
> >  		event++;
> >  
> > -	if (is_return && isdigit(argv[0][1])) {
> > +	if (isdigit(argv[0][1])) {
> > +		if (!is_return) {
> > +			pr_info("Maxactive is not for kprobe");
> 
> So now 'p1:..." will error out and not just be ignored?

Yes, I think it is better to tell user "your command has a
meaningless option, maybe you made a mistake" than ignore that.

Thank you,

> 
> -- Steve
> 
> > +			return -EINVAL;
> > +		}
> >  		if (event)
> >  			len = event - &argv[0][1] - 1;
> >  		else
> > @@ -634,8 +638,8 @@ static int trace_kprobe_create(int argc, const char *argv[])
> >  		memcpy(buf, &argv[0][1], len);
> >  		buf[len] = '\0';
> >  		ret = kstrtouint(buf, 0, &maxactive);
> > -		if (ret) {
> > -			pr_info("Failed to parse maxactive.\n");
> > +		if (ret || !maxactive) {
> > +			pr_info("Invalid maxactive number\n");
> >  			return ret;
> >  		}
> >  		/* kretprobes instances are iterated over via a list. The
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2019-03-13 14:37 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 [this message]
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
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=20190313233739.09f58a0c5762d9a43470046b@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.