From 40c4b47f41b95dff743c841536cb64014e65ef0c Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Thu, 23 Apr 2026 07:54:17 -0700 Subject: [PATCH 1/4] 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 ] Fixes: 5b472b6e5bd9 ("x86_64/bug: Implement __WARN_printf()") Fixes: 11bb4944f014 ("x86/bug: Implement WARN_ONCE()") Signed-off-by: Sean Christopherson Signed-off-by: Dave Hansen Acked-by: Dave Hansen Link: https://lore.kernel.org/all/adc1IrD8uqWdaOKv@yzhao56-desk.sh.intel.com Link: https://patch.msgid.link/20260423145419.459988-2-seanjc@google.com --- arch/x86/include/asm/bug.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index 80c1696d8d59..bf3c802654d1 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -153,6 +153,7 @@ struct arch_va_list { struct sysv_va_list args; }; extern void *__warn_args(struct arch_va_list *args, struct pt_regs *regs); +static __always_inline __printf(1, 2) void __WARN_validate_printf(const char *fmt, ...) { } #endif /* __ASSEMBLER__ */ #define __WARN_bug_entry(flags, format) ({ \ @@ -172,6 +173,7 @@ extern void *__warn_args(struct arch_va_list *args, struct pt_regs *regs); #define __WARN_print_arg(flags, format, arg...) \ do { \ int __flags = (flags) | BUGFLAG_WARNING | BUGFLAG_ARGS ; \ + __WARN_validate_printf(format, ## arg); \ static_call_mod(WARN_trap)(__WARN_bug_entry(__flags, format), ## arg); \ asm (""); /* inhibit tail-call optimization */ \ } while (0) From 23aea3c539a62ab97ca3aecf41d590d91f2911fc Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Thu, 23 Apr 2026 07:54:18 -0700 Subject: [PATCH 2/4] x86/bug: Put HAVE_ARCH_BUG_FORMAT_ARGS WARN definitions inside __ASSEMBLER__ Extend the !assembly #ifdef guarding x86's custom WARN helpers to cover the WARN macros themselves, as they aren't assembly friendly. This helps make it clear that things like __WARN_validate_printf() don't need a dummy definition for assembly code. No functional change intended. Suggested-by: Yan Zhao Signed-off-by: Sean Christopherson Signed-off-by: Dave Hansen Link: https://patch.msgid.link/20260423145419.459988-3-seanjc@google.com --- arch/x86/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index bf3c802654d1..23ab05438269 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -154,7 +154,6 @@ struct arch_va_list { }; extern void *__warn_args(struct arch_va_list *args, struct pt_regs *regs); static __always_inline __printf(1, 2) void __WARN_validate_printf(const char *fmt, ...) { } -#endif /* __ASSEMBLER__ */ #define __WARN_bug_entry(flags, format) ({ \ struct bug_entry *bug; \ @@ -189,6 +188,7 @@ do { \ } \ __ret_warn_on; \ }) +#endif /* __ASSEMBLER__ */ #endif /* HAVE_ARCH_BUG_FORMAT_ARGS */ From c256d2a8adf2f5670ca262979c451ec4c1108e38 Mon Sep 17 00:00:00 2001 From: Ethan Nelson-Moore Date: Sat, 16 May 2026 19:57:08 -0700 Subject: [PATCH 3/4] x86: Remove unnecessary architecture-specific arch/x86/include/asm/device.h is identical to include/asm-generic/device.h, and therefore the x86-specific version is unnecessary. Remove it. [ dhansen: Minor note: It looks like if asm/foo.h does not exist that the build system generates one that does a #include . Thus, all that needs to be done is remove the arch-specific one. ] Signed-off-by: Ethan Nelson-Moore Signed-off-by: Dave Hansen Link: https://patch.msgid.link/20260517025713.97791-1-enelsonmoore@gmail.com --- arch/x86/include/asm/device.h | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 arch/x86/include/asm/device.h diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h deleted file mode 100644 index 7c0a52ca2f4d..000000000000 --- a/arch/x86/include/asm/device.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_X86_DEVICE_H -#define _ASM_X86_DEVICE_H - -struct dev_archdata { -}; - -struct pdev_archdata { -}; - -#endif /* _ASM_X86_DEVICE_H */ From 1d2cf6d5b5994df68e3431f0a1a8f72a191b8aad Mon Sep 17 00:00:00 2001 From: Rick Edgecombe Date: Wed, 27 May 2026 15:13:42 -0700 Subject: [PATCH 4/4] MAINTAINERS: Move Rick Edgecombe to TDX maintainer Per some offline discussion with Kiryl, he could use some help on the TDX host side. I have worked on the TDX host side for the past few years including wrangling the initial KVM support, and can help with this. I am already listed as TDX reviewer. Move it to maintainer. Signed-off-by: Rick Edgecombe Signed-off-by: Dave Hansen Reviewed-by: Kiryl Shutsemau (Meta) Link: https://patch.msgid.link/20260527221342.415814-1-rick.p.edgecombe@intel.com --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 2fb1c75afd16..0e14dd3d5297 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -28908,8 +28908,8 @@ F: arch/x86/kernel/unwind_*.c X86 TRUST DOMAIN EXTENSIONS (TDX) M: Kiryl Shutsemau +M: Rick Edgecombe R: Dave Hansen -R: Rick Edgecombe L: x86@kernel.org L: linux-coco@lists.linux.dev L: kvm@vger.kernel.org