From: Tom Zanussi <zanussi@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: vincent@bernat.ch, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] tracing: Fix NULL pointer bug in hist key expressions
Date: Thu, 08 Nov 2018 13:12:33 -0600 [thread overview]
Message-ID: <1541704353.10405.8.camel@kernel.org> (raw)
In-Reply-To: <20181108134507.2c343e6b@gandalf.local.home>
Hi Steve,
On Thu, 2018-11-08 at 13:45 -0500, Steven Rostedt wrote:
> On Thu, 8 Nov 2018 08:41:47 -0600
> Tom Zanussi <zanussi@kernel.org> wrote:
>
> > From: Tom Zanussi <tom.zanussi@linux.intel.com>
> >
> > Hi Steve,
> >
> > This is a fix for a user-reported bug in the hist triggers, where
> > if a
> > variable reference is used in an expression in a histogram key, it
> > results in a NULL pointer dereference and subsequent Oops.
>
> How does one add a variable reference as an expression in a
> histogram key?
>
> Can you show an example?
>
Sure, here's the example that showed the problem, and which the patch
fixes:
echo 'r:fib_table_lookup_ret fib_table_lookup $retval' > /sys/kernel/debug/tracing/kprobe_events
echo 'hist:keys=cpu:ts0=common_timestamp' > /sys/kernel/debug/tracing/events/fib/fib_table_lookup/trigger
echo 'hist:keys=cpu,common_timestamp-$ts0' > /sys/kernel/debug/tracing/events/kprobes/fib_table_lookup_ret/trigger
The following is also a variable reference in an expression, but in
this case the expression is the variable reference alone, which the
existing code handles properly and returns -EINVAL.
echo 'hist:keys=cpu,$ts0' > /sys/kernel/debug/tracing/events/kprobes/fib_table_lookup_ret/trigger
Tom
> -- Steve
>
> >
> > I separated the fix into two small patches, the first preventing
> > the
> > immediate problem bu disallowing a var_ref from ever accessing a
> > NULL
> > element, and the second disallowing a user from ever constructing
> > such
> > a key.
> >
> > Thanks,
> >
> > Tom
> >
> > The following changes since commit
> > ee474b81fe5aa5dc0faae920bf66240fbf55f891:
> >
> > tracing/kprobes: Fix strpbrk() argument order (2018-11-05
> > 09:47:14 -0500)
> >
> > are available in the git repository at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-
> > trace.git ftrace/key-ref-fix
> >
> > Tom Zanussi (2):
> > tracing: Prevent hist_field_var_ref() from accessing NULL
> > tracing_map_elts
> > tracing: Check keys for variable references in expressions too
> >
> > kernel/trace/trace_events_hist.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
>
>
prev parent reply other threads:[~2018-11-08 19:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 14:41 [PATCH 0/2] tracing: Fix NULL pointer bug in hist key expressions Tom Zanussi
2018-11-08 14:41 ` [PATCH 1/2] tracing: Prevent hist_field_var_ref() from accessing NULL tracing_map_elts Tom Zanussi
2018-11-08 14:41 ` [PATCH 2/2] tracing: Check keys for variable references in expressions too Tom Zanussi
2018-11-08 18:45 ` [PATCH 0/2] tracing: Fix NULL pointer bug in hist key expressions Steven Rostedt
2018-11-08 19:12 ` Tom Zanussi [this message]
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=1541704353.10405.8.camel@kernel.org \
--to=zanussi@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=vincent@bernat.ch \
/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.