From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C48B51E9906 for ; Thu, 23 Apr 2026 14:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776956064; cv=none; b=X52eKMbXgiYy9tQKvC7p8oOgBIxcv6PuqXojMSfjlmAQhznKrCvzwpsLtvip3AKC252x1zXit0vDa57fcuBtcD8B0tA3604w0D4/f0oxSI2BcqRlQ+p/6U+fE8w8/Tfq7PtPGHpqHFaGoqqj1ork96AGMdemXm8gTotOjelBphE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776956064; c=relaxed/simple; bh=2UnlOw9Fnz0XNo29/aAcKq4dT0830rUVsbyvVUWHFOw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=aZ0WNQlFo6VuJa5ZfBYdyojhYcm6//LhmG+NCMyiW+okKffOKSPJLCieUivHl2mrycgWmRxCIPhTc4Gaou8mK2KLc8W9vjN2byhjVbRuPdSQdlAgJwpgF0msOfNhza4PqAboVgNqWd1A77siv/zx74rYxBnV+a2z3FrszkjlmfI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=LJGWlFx4; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="LJGWlFx4" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2b4654f9bb6so71230015ad.2 for ; Thu, 23 Apr 2026 07:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1776956063; x=1777560863; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=vdw27UvnO47Uwczc9HZiUFzil09AlYIBRMOKHioB0qc=; b=LJGWlFx41yrQItogLj9ZIUTNSZsojgwhcaQkSJk28d/c7v+n+UfAfmh3+hJSddBBH+ kJBMTxC+xi3th3MKsAdZoUoAyvKXGy9qLj3kP+EKeVC6gEF7HKe1BCnWmigem6AqQON1 R+mC6kso7o11vqi6HrJPkxCdIrtIiNSkQ98on2jHCrIIaJLZkIasCGhFQXEHToSnSb19 bF5hGrpMpZFkZaiQpxYRlHZf6KVF8kiU/s3idtx1IFw5N0u2GFMJptC9x00bDj3syDl+ /2nyjOgNHJIPDP2EIpDyYnSNrTIUZ4oH0YdMEcMFm/BLnzO5WK4XHM2stYXzSMK/gggw +Asg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776956063; x=1777560863; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vdw27UvnO47Uwczc9HZiUFzil09AlYIBRMOKHioB0qc=; b=GQsRZKBZTUEZGI3IMg/pi5tkbvItpAoJAkH6GsSRGeNfLT8Ur4cHA3E9gIo4uC08ps GPw3QO0M/7DM7aK8iB4vdxHKU0ba5iZZEFmXteh21Ap6Rdg1LBp7WW/niJrdjbfFv6oh eNECeOUHG4pNarl5nvUgZb8+u4moWuFgWoOi/7d+wvAqBuDAWckKQdyxNzdV8+vulfiB V7z6q6JBXPCHv2+noOX2GH0n8fFiEKxtn9XutbS7ojrgoLEur4PJ+gG4K0ZVBwlswnzA qOeEM9QvUA8+aFTIWEYS/H1MTxc8dHVnJybFDQjO277lFZjJk+yFmglivc2+2Xq7L2Y6 AO4Q== X-Gm-Message-State: AOJu0YyrRJ3sLujTiEkgH3N9dYHt1HMUdcRszrdB+mx5yRZ/CeyRxV8m P/lW1lc60xl2bAVVcJV8hLRaWgz7YYglPvUcpL59botv7zmXFG3VJXGkhfjK87yDwLK19hQAFji lVwGi3w== X-Received: from plcb17.prod.google.com ([2002:a17:902:d311:b0:2ae:6338:73ca]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:aa98:b0:2b4:5cb8:99eb with SMTP id d9443c01a7336-2b5f9f8808amr210343485ad.27.1776956062911; Thu, 23 Apr 2026 07:54:22 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 23 Apr 2026 07:54:16 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.545.g6539524ca2-goog Message-ID: <20260423145419.459988-1-seanjc@google.com> Subject: [PATCH v2 0/2] x86/bug: Add printf() validation to x86's custom WARNs From: Sean Christopherson To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: linux-kernel@vger.kernel.org, Yan Zhao , Peter Zijlstra , Sean Christopherson Content-Type: text/plain; charset="UTF-8" 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