Skip to content

x86/bug: Add printf() validation to x86's custom WARNs

Sean Christopherson lkml 2 versions – Applied

Status from this message: The following commit has been merged into the x86/misc branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 4 repliesApplied
  2. v11 patch 2 repliesSuperseded

Changes in v2 from the cover letter

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

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2x86/bug: Add printf() validation to HAVE_ARCH_BUG_FORMAT_ARGS WARNsarch/x86/include/asm/bug.h+2 -04 replies
2/2x86/bug: Put HAVE_ARCH_BUG_FORMAT_ARGS WARN definitions inside __ASSEMBLER__arch/x86/include/asm/bug.h+1 -10 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchDave Hansen
1/2A-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] x86/bug: Add printf() validation to x86's custom WARNs

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/[email protected]

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

Signature · 1 line
2.54.0.545.g6539524ca2-goog