From: Jiri Olsa <jolsa@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Jiri Olsa <jolsa@kernel.org>, lkml <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [RFC/PATCH] lib/vsprintf: Add support to store cpumask
Date: Wed, 29 Jun 2016 08:43:48 +0200 [thread overview]
Message-ID: <20160629064348.GA12326@krava> (raw)
In-Reply-To: <20160628180647.1e90257e@gandalf.local.home>
On Tue, Jun 28, 2016 at 06:06:47PM -0400, Steven Rostedt wrote:
> On Tue, 28 Jun 2016 21:27:29 +0200
> Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
>
> > > I probably should make a trace_printk() that doesn't default to the
> > > binary print, to handle things like this.
> > >
> > > trace_printk_ptr()?
> > >
> > > Or even just see if I can find a way that detects this in the fmt
> > > string. Hmm, that probably can't be done at compile time :-/
> >
> > Well, not with gcc itself, but it wouldn't be too hard to make smatch
> > complain loudly if trace_printk is used on a format string with any %p
> > extension (directing people to use trace_printk_ptr()) - the format
> > parsing (and type checking) is already there.
>
> Well, actually gcc can (see below). Although, the more I think about
> this, the more I'm thinking that the bin_printk() should be default
> just copy the pointer content. As the whole point of bin_printk() is to
> print the content at another time. And since pointers should not be
> dereferenced later, it should be saved at the moment the bprintk() is
> called and not dereferenced later.
>
> -- Steve
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 94aa10ffe156..62693900cc4b 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -631,7 +631,24 @@ do { \
> \
> __trace_printk_check_format(fmt, ##args); \
> \
> - if (__builtin_constant_p(fmt)) \
> + if (__builtin_constant_p(fmt) && \
> + !__builtin_strstr(fmt, "%pF") && \
> + !__builtin_strstr(fmt, "%pf") && \
> + !__builtin_strstr(fmt, "%pR") && \
> + !__builtin_strstr(fmt, "%pr") && \
> + !__builtin_strstr(fmt, "%pb") && \
> + !__builtin_strstr(fmt, "%pM") && \
> + !__builtin_strstr(fmt, "%pI") && \
> + !__builtin_strstr(fmt, "%pE") && \
> + !__builtin_strstr(fmt, "%pU") && \
> + !__builtin_strstr(fmt, "%pV") && \
> + !__builtin_strstr(fmt, "%pN") && \
> + !__builtin_strstr(fmt, "%pa") && \
> + !__builtin_strstr(fmt, "%pd") && \
> + !__builtin_strstr(fmt, "%pC") && \
> + !__builtin_strstr(fmt, "%pD") && \
> + !__builtin_strstr(fmt, "%pg") && \
> + !__builtin_strstr(fmt, "%pG")) \
> __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
> else \
> __trace_printk(_THIS_IP_, fmt, ##args); \
is this one working? it seems better to me than adding new trace_printk_ptr
jirka
next prev parent reply other threads:[~2016-06-29 6:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-28 15:34 [RFC/PATCH] lib/vsprintf: Add support to store cpumask Jiri Olsa
2016-06-28 16:26 ` Steven Rostedt
2016-06-28 19:27 ` Rasmus Villemoes
2016-06-28 19:56 ` Steven Rostedt
2016-06-28 21:50 ` Rasmus Villemoes
2016-06-28 22:05 ` Steven Rostedt
2016-06-28 22:06 ` Steven Rostedt
2016-06-29 6:43 ` Jiri Olsa [this message]
2016-06-29 15:42 ` Steven Rostedt
2016-06-28 21:19 ` Rasmus Villemoes
2016-06-29 7:12 ` Jiri Olsa
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=20160629064348.GA12326@krava \
--to=jolsa@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--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).