public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] x86/bug: Add printf() validation to x86's custom WARNs
@ 2026-04-23 14:54 Sean Christopherson
  2026-04-23 14:54 ` [PATCH v2 1/2] x86/bug: Add printf() validation to HAVE_ARCH_BUG_FORMAT_ARGS WARNs Sean Christopherson
  2026-04-23 14:54 ` [PATCH v2 2/2] x86/bug: Put HAVE_ARCH_BUG_FORMAT_ARGS WARN definitions inside __ASSEMBLER__ Sean Christopherson
  0 siblings, 2 replies; 9+ messages in thread
From: Sean Christopherson @ 2026-04-23 14:54 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86
  Cc: linux-kernel, Yan Zhao, Peter Zijlstra, Sean Christopherson

In x86's custom HAVE_ARCH_BUG_FORMAT_ARGS WARNs, invoke a dummy function
with __printf() annotation to validate the formatting+arguments of any
provided messages.

Yan reported a bug where I botched the formatting of a WARN_ONCE() argument,
but none of my builds (with W=1 and -Werror) detected the issue, nor did any
of the build bots (AFAIK).  Turns out that Yan found it via CONFIG_BUG=n,
which due to the code being 64-bit-only, was the only way to detect the
malformed message.

v2:
 - Drop the dummy macro for assembly code. [Yan]
 - Extend the #ifdeffery to hide the WARN macros themselves from assembly
   code. [Yan]

v1: https://lore.kernel.org/all/20260409182941.1912856-1-seanjc@google.com

Sean Christopherson (2):
  x86/bug: Add printf() validation to HAVE_ARCH_BUG_FORMAT_ARGS WARNs
  x86/bug: Put HAVE_ARCH_BUG_FORMAT_ARGS WARN definitions inside
    __ASSEMBLER__

 arch/x86/include/asm/bug.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


base-commit: 59287e6ad4a9e5d13519b783d6bbc1015b94d63e
-- 
2.54.0.545.g6539524ca2-goog


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-04-27 19:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 14:54 [PATCH v2 0/2] x86/bug: Add printf() validation to x86's custom WARNs Sean Christopherson
2026-04-23 14:54 ` [PATCH v2 1/2] x86/bug: Add printf() validation to HAVE_ARCH_BUG_FORMAT_ARGS WARNs Sean Christopherson
2026-04-23 15:12   ` Dave Hansen
2026-04-23 15:47     ` Sean Christopherson
2026-04-23 16:58       ` Dave Hansen
2026-04-27 19:05   ` [tip: x86/misc] " tip-bot2 for Sean Christopherson
2026-04-27 19:55     ` Sean Christopherson
2026-04-23 14:54 ` [PATCH v2 2/2] x86/bug: Put HAVE_ARCH_BUG_FORMAT_ARGS WARN definitions inside __ASSEMBLER__ Sean Christopherson
2026-04-27 19:05   ` [tip: x86/misc] " tip-bot2 for Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox