[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vf=tYmWXDUZDqcMK4i8k6_VBqGttw6-mEgt6VhvRVFwuA@mail.gmail.com>
Date: Wed, 2 Apr 2025 22:25:46 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>, Kees Cook <kees@...nel.org>,
Nathan Chancellor <nathan@...nel.org>
Cc: Petr Mladek <pmladek@...e.com>, Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>, John Ogness <john.ogness@...utronix.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>, Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL] more printk for 6.15
+Cc: Kees and Nathan (I believe this discussion has some material for
you, folks, to think of / comment on / etc)
On Wed, Apr 2, 2025 at 10:06 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Wed, 2 Apr 2025 at 11:39, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> >
> > Yes. Clang complains on unknown pragma.
>
> What a crock.
>
> It says GCC, for chrissake!
>
> And clang clearly doesn't complain about
>
> > +#pragma GCC diagnostic push
> > +#pragma GCC diagnostic pop
>
> which are *not* protected by that #ifndef __clang__ thing.
>
> So this smells like a clang bug to me.
I Cc'ed Nathan, perhaps he can comment on this.
> Can we please use wrapper defines instead so that we don't have that
> #ifndef in the middle of code? And since those don't work with
> '#pragma', they need to use the _Pragma() operator instead.
>
> Something like
>
> #define GCC_PRAGMA(x) _Pragma(#x)
>
> in compiler-gcc.h, and then add a
>
> #ifndef GCC_PRAGMA
> #define GCC_PRAGMA(x) /* Nothing */
> #endif
>
> and then you can just do
>
> GCC_PRAGMA(Wsuggest-attribute=format)
>
> in places like this?
>
> (Entirely untested: I *despise* pragma in general).
Maybe. Tomorrow I can look at this.
> Or hey, how about we just add "-Wno-suggest-attribute=format" to the
> compiler command line? Like we do for all the other garbage warnings
> that we don't want to see.
I actually don't know what the benefit of __printf() attribute from
security (?) point of view is. I may speculate that this helps to
validate the format string and arguments (when provided as ...) and
helps with potential wrong argument sizes, etc. Kees, what do you
think about Linus' proposal?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists