Re: [tip: x86/misc] x86/bug: Add printf() validation to HAVE_ARCH_BUG_FORMAT_ARGS WARNs

From: Sean Christopherson

Date: Mon Apr 27 2026 - 15:57:51 EST


On Mon, Apr 27, 2026, tip-bot2 for Sean Christopherson wrote:
> The following commit has been merged into the x86/misc branch of tip:
>
> Commit-ID: 40c4b47f41b95dff743c841536cb64014e65ef0c
> Gitweb: https://git.kernel.org/tip/40c4b47f41b95dff743c841536cb64014e65ef0c
> Author: Sean Christopherson <seanjc@xxxxxxxxxx>
> AuthorDate: Thu, 23 Apr 2026 07:54:17 -07:00
> Committer: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> CommitterDate: Mon, 27 Apr 2026 12:02:40 -07:00
>
> x86/bug: Add printf() validation to HAVE_ARCH_BUG_FORMAT_ARGS WARNs
>
> Add explicit printf() validation for x86-64's newfangled WARN
> implementation, as most (all?) compilers fail to detect basic formatting
> issues without the annotation. E.g. even goofs like printing a u64 as a
> string aren't detected:
>
> WARN_ONCE(1, "Bad message, %s", vcpu->arch.last_guest_tsc);
>
> 32-bit x86 doesn't support HAVE_ARCH_BUG_FORMAT_ARGS and uses generic
> implementations that provide printf() validation. This means there's
> now a big blind spot is code that is strictly x86-64. Inconveniently,
> new features are also frequently x86-64-only.
>
> Fix the blind 64-bit blind spot.
>
> [ dhansen: changelog tweaks to flesh out the 64-bit-only details ]

Much better than what I wrote, thanks Dave!