linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Artem Savkov <asavkov@redhat.com>, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH] kprobes: fix trace_probe flags in enable_trace_kprobe
Date: Thu, 26 Jul 2018 00:35:24 +0900	[thread overview]
Message-ID: <20180726003524.e5ad32fc6b30476ccb0ebdc5@kernel.org> (raw)
In-Reply-To: <20180725092151.11b9f2e1@gandalf.local.home>

On Wed, 25 Jul 2018 09:21:51 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> [ Adding Masami to Cc ]
> 
> On Wed, 25 Jul 2018 12:28:26 +0200
> Artem Savkov <asavkov@redhat.com> wrote:
> 
> > If enable_trace_kprobe fails to enable the probe in enable_k(ret)probe
> > it returns an error, but does not unset the tp flags it set previosly.
> > This results in a probe being considered enabled and failures like being
> > unable to remove the probe through kprobe_events file since probes_open()
> > expects every probe to be disabled.
> > 
> 
> Looks good to me. Masami, want to ack it?

Yes, looks good to me too.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thanks Artem!

> 
> -- Steve
> 
> > Signed-off-by: Artem Savkov <asavkov@redhat.com>
> > ---
> >  kernel/trace/trace_kprobe.c | 13 +++++++++++--
> >  1 file changed, 11 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> > index 21f718472942..fb887ced5056 100644
> > --- a/kernel/trace/trace_kprobe.c
> > +++ b/kernel/trace/trace_kprobe.c
> > @@ -400,11 +400,10 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,
> >  static int
> >  enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
> >  {
> > +	struct event_file_link *link;
> >  	int ret = 0;
> >  
> >  	if (file) {
> > -		struct event_file_link *link;
> > -
> >  		link = kmalloc(sizeof(*link), GFP_KERNEL);
> >  		if (!link) {
> >  			ret = -ENOMEM;
> > @@ -424,6 +423,16 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
> >  		else
> >  			ret = enable_kprobe(&tk->rp.kp);
> >  	}
> > +
> > +	if (ret) {
> > +		if (file) {
> > +			list_del(&link->list);
> > +			kfree(link);
> > +			tk->tp.flags &= ~TP_FLAG_TRACE;
> > +		} else {
> > +			tk->tp.flags &= ~TP_FLAG_PROFILE;
> > +		}
> > +	}
> >   out:
> >  	return ret;
> >  }
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2018-07-25 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25 10:28 [PATCH] kprobes: fix trace_probe flags in enable_trace_kprobe Artem Savkov
2018-07-25 13:21 ` Steven Rostedt
2018-07-25 15:35   ` Masami Hiramatsu [this message]
2018-07-25 13:56 ` Josh Poimboeuf
2018-07-25 14:05   ` Steven Rostedt

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=20180726003524.e5ad32fc6b30476ccb0ebdc5@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=asavkov@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).