From nobody Mon Jun 15 10:51:47 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB27F3EE1CE; Mon, 27 Apr 2026 19:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777316713; cv=none; b=NZDJgSQcDm0P8adqIftWYROxSfOAibs0yp4v1h5uJjapaixtrNUbNMm0KkJUf8vw2l1z8vW4ryxPUbLR2hXqBVAr4NmydVLivu6/Z7Ai2R0bLsVCQVX8tsZLw/cV/2PQSmgyhS6lzn+W/jROJv1iYWeqW5q8yoMVEPqcemP+weg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777316713; c=relaxed/simple; bh=fGWUgx4rpzX3S+qMSf97mx2HQsm+WEIKJfoKaTuv/p0=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=p2XgXgIRdCRgekrtF1uHdzvsyv5ho+2si3Gw0ftKD/luKdjNjvaSjJ3XPdAcFZqYBy2hEa3q54eoz9uyzhNpad12trYHa+jqsJcOM55xP3RR1rhMlC34KqYIHwd460KlJ49bOVzFpRXV69j7CIxNumtS88c81mtJ2D9CAhmYmY8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OkLIcB3X; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sMEcjKFh; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OkLIcB3X"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sMEcjKFh" Date: Mon, 27 Apr 2026 19:05:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777316710; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=emVyL9McguGIkP7VyrEe3xndDg5aHdZK9RqNVycIkhk=; b=OkLIcB3XAfkIxrxk9Mw62iLzKziJIBbUgXVh6LjE6iCySlNXUzjM0y9COO1XhUV27FsknC 2L7I68mtk8fyhSTiG3Oam4ZtstO1HFBVQYYWLd7S2yuDv+wGEoAHEsA10E+OA3OolrOKYs RPwZ0I3/fxX5wMYOP6ThGndLX6lV8uzXqeU5LRYM5xcYbEm3twpIPD6BSt8nZ23MeIl/Mo 2nuREP0NFMEiYKXEo/4SNIRlVqbk8MQr/dk564tWbQtXtxUZL04H5lq2XutUb1tadwt2y9 7MxOW55iq7oLQLk4t/j3DAMWB4hiGUc68uh141OScfT/nQs1hzSFyK7GXzWm8g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777316710; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=emVyL9McguGIkP7VyrEe3xndDg5aHdZK9RqNVycIkhk=; b=sMEcjKFhQ+jjDU1ANT1w+TPAFqRyVkwFfUok+0Qn0hvo6wsZ99zQHpmA5AYS9RfVq45Zt/ fiM8BIni7yVuXNAQ== From: "tip-bot2 for Sean Christopherson" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/misc] x86/bug: Add printf() validation to HAVE_ARCH_BUG_FORMAT_ARGS WARNs Cc: Sean Christopherson , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260423145419.459988-2-seanjc@google.com> References: <20260423145419.459988-2-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177731670864.3521451.17700947894959847025.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/misc branch of tip: Commit-ID: 40c4b47f41b95dff743c841536cb64014e65ef0c Gitweb: https://git.kernel.org/tip/40c4b47f41b95dff743c841536cb64014= e65ef0c Author: Sean Christopherson AuthorDate: Thu, 23 Apr 2026 07:54:17 -07:00 Committer: Dave Hansen 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 ] 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 80c1696..bf3c802 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 ch= ar *fmt, ...) { } #endif /* __ASSEMBLER__ */ =20 #define __WARN_bug_entry(flags, format) ({ \ @@ -172,6 +173,7 @@ extern void *__warn_args(struct arch_va_list *args, str= uct pt_regs *regs); #define __WARN_print_arg(flags, format, arg...) \ do { \ int __flags =3D (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)