From: Steven Rostedt <rostedt@goodmis.org>
To: Jiri Olsa <jolsa@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>, Song Liu <songliubraving@fb.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Yonghong Song <yhs@fb.com>, Josef Bacik <jbacik@fb.com>,
daniel@iogearbox.net, davem@davemloft.net,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] tracing/kprobe: Release kprobe print_fmt properly
Date: Mon, 9 Jul 2018 12:44:16 -0400 [thread overview]
Message-ID: <20180709124416.2527e40e@gandalf.local.home> (raw)
In-Reply-To: <20180709141906.2390-1-jolsa@kernel.org>
On Mon, 9 Jul 2018 16:19:06 +0200
Jiri Olsa <jolsa@kernel.org> wrote:
> We don't release tk->tp.call.print_fmt when destroying
> local uprobe. Also there's missing print_fmt kfree in
> create_local_trace_kprobe error path.
>
> Fixes: e12f03d7031a ("perf/core: Implement the 'perf_kprobe' PMU")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Thanks for the patch, I'm applying it now (and testing it).
> ---
> kernel/trace/trace_kprobe.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index daa81571b22a..21f718472942 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -1480,8 +1480,10 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
> }
>
> ret = __register_trace_kprobe(tk);
> - if (ret < 0)
> + if (ret < 0) {
> + kfree(tk->tp.call.print_fmt);
> goto error;
> + }
>
> return &tk->tp.call;
> error:
> @@ -1501,6 +1503,8 @@ void destroy_local_trace_kprobe(struct trace_event_call *event_call)
> }
>
> __unregister_trace_kprobe(tk);
> +
> + kfree(tk->tp.call.print_fmt);
Bah! The naming convention of "set_print_fmt()" is horrible, and leads
to these kinds of bugs. I'll make a patch (not for stable though) that
makes it a bit more obvious to what is happening.
-- Steve
> free_trace_kprobe(tk);
> }
> #endif /* CONFIG_PERF_EVENTS */
next prev parent reply other threads:[~2018-07-09 16:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 14:19 [PATCH] tracing/kprobe: Release kprobe print_fmt properly Jiri Olsa
2018-07-09 16:40 ` Song Liu
2018-07-09 16:44 ` Steven Rostedt [this message]
2018-07-10 13:04 ` Steven Rostedt
2018-07-11 12:54 ` Steven Rostedt
2018-07-11 13:26 ` Masami Hiramatsu
2018-07-11 13:29 ` 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=20180709124416.2527e40e@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=acme@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jbacik@fb.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
--cc=yhs@fb.com \
/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).