From: "Tobin C. Harding" <me@tobin.cc>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: kernel-hardening@lists.openwall.com,
Tycho Andersen <tycho@tycho.ws>,
Linus Torvalds <torvalds@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Alexei Starovoitov <ast@kernel.org>,
linux-kernel@vger.kernel.org,
Network Development <netdev@vger.kernel.org>
Subject: Re: [PATCH 3/3] trace: print address if symbol not found
Date: Tue, 19 Dec 2017 09:35:04 +1100 [thread overview]
Message-ID: <20171218223504.GD19604@eros> (raw)
In-Reply-To: <20171218114947.2c11211a@gandalf.local.home>
On Mon, Dec 18, 2017 at 11:49:47AM -0500, Steven Rostedt wrote:
> On Mon, 18 Dec 2017 10:53:32 +1100
> "Tobin C. Harding" <me@tobin.cc> wrote:
>
> > Fixes behaviour modified by: commit bd6b239cdbb2 ("kallsyms: don't leak
> > address when symbol not found")
> >
> > Previous patch changed behaviour of kallsyms function sprint_symbol() to
> > return an error code instead of printing the address if a symbol was not
> > found. Ftrace relies on the original behaviour. We should not break
> > tracing when applying the previous patch. We can maintain the original
> > behaviour by checking the return code on calls to sprint_symbol() and
> > friends.
> >
> > Check return code and print actual address on error (i.e symbol not
> > found).
> >
> > Signed-off-by: Tobin C. Harding <me@tobin.cc>
> > ---
> > kernel/trace/trace.h | 24 ++++++++++++++++++++++++
> > kernel/trace/trace_events_hist.c | 6 +++---
> > 2 files changed, 27 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> > index 2a6d0325a761..881b1a577d75 100644
> > --- a/kernel/trace/trace.h
> > +++ b/kernel/trace/trace.h
> > @@ -1814,4 +1814,28 @@ static inline void trace_event_eval_update(struct trace_eval_map **map, int len)
> >
> > extern struct trace_iterator *tracepoint_print_iter;
> >
> > +static inline int
> > +trace_sprint_symbol(char *buffer, unsigned long address)
> > +{
> > + int ret;
> > +
> > + ret = sprint_symbol(buffer, address);
> > + if (ret == -1)
> > + ret = sprintf(buffer, "0x%lx", address);
> > +
> > + return ret;
> > +}
> > +
> > +static inline int
> > +trace_sprint_symbol_no_offset(char *buffer, unsigned long address)
> > +{
> > + int ret;
> > +
> > + ret = sprint_symbol_no_offset(buffer, address);
> > + if (ret == -1)
> > + ret = sprintf(buffer, "0x%lx", address);
> > +
> > + return ret;
> > +}
> > +
> > #endif /* _LINUX_KERNEL_TRACE_H */
> > diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> > index 1e1558c99d56..3e28522a76f4 100644
> > --- a/kernel/trace/trace_events_hist.c
> > +++ b/kernel/trace/trace_events_hist.c
> > @@ -982,7 +982,7 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
> > return;
> >
> > seq_printf(m, "%*c", 1 + spaces, ' ');
> > - sprint_symbol(str, stacktrace_entries[i]);
> > + trace_sprint_symbol_addr(str, stacktrace_entries[i]);
>
> Hmm, where is trace_sprint_symbol_addr() defined?
>
> -- Steve
Also, I missed one in kernel/trace/trace_output.c
Added for next version.
thanks,
Tobin.
next prev parent reply other threads:[~2017-12-18 22:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-17 23:53 [PATCH 0/3] kallsyms: don't leak address Tobin C. Harding
2017-12-17 23:53 ` [PATCH 1/3] kallsyms: don't leak address when symbol not found Tobin C. Harding
2017-12-18 9:55 ` Felix Fietkau
2017-12-18 22:41 ` Tobin C. Harding
2017-12-18 23:43 ` Steven Rostedt
2017-12-19 0:24 ` Tobin C. Harding
2017-12-17 23:53 ` [PATCH 2/3] vsprintf: print <no-symbol> if " Tobin C. Harding
2017-12-18 0:04 ` Joe Perches
2017-12-18 1:04 ` Tobin C. Harding
2017-12-17 23:53 ` [PATCH 3/3] trace: print address " Tobin C. Harding
2017-12-18 16:49 ` Steven Rostedt
2017-12-18 21:16 ` Tobin C. Harding
2017-12-18 23:51 ` Steven Rostedt
2017-12-19 0:22 ` Tobin C. Harding
2017-12-19 3:00 ` Tobin C. Harding
2017-12-19 3:02 ` Tobin C. Harding
2017-12-19 3:37 ` Steven Rostedt
2017-12-19 4:20 ` Tobin C. Harding
2017-12-18 22:35 ` Tobin C. Harding [this message]
2017-12-19 23:19 ` kbuild test robot
2017-12-19 23:39 ` kbuild test robot
2017-12-18 5:31 ` [kernel-hardening] [PATCH 0/3] kallsyms: don't leak address Michael Ellerman
2017-12-18 6:00 ` Tobin C. Harding
2017-12-18 9:17 ` Tobin C. Harding
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=20171218223504.GD19604@eros \
--to=me@tobin.cc \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
--cc=tycho@tycho.ws \
--cc=yamada.masahiro@socionext.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).