Re: [PATCH v6 3/4] atomic: Add alignment check to instrumented atomic operations

From: Peter Zijlstra
Date: Mon Jan 05 2026 - 11:33:12 EST


On Wed, Dec 31, 2025 at 07:25:42PM +1100, Finn Thain wrote:
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
>
> Add a Kconfig option for debug builds which logs a warning when an
> instrumented atomic operation takes place that's misaligned.
> Some platforms don't trap for this.
>
> [fthain: added __DISABLE_BUG_TABLE macro.]
>
> Cc: Sasha Levin <sashal@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Link: https://lore.kernel.org/lkml/20250901093600.GF4067720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
> Link: https://lore.kernel.org/linux-next/df9fbd22-a648-ada4-fee0-68fe4325ff82@xxxxxxxxxxxxxx/
> Signed-off-by: Finn Thain <fthain@xxxxxxxxxxxxxx>
> ---
> Checkpatch.pl says...
> ERROR: Missing Signed-off-by: line by nominal patch author 'Peter Ziljstra <peterz@xxxxxxxxxxxxx>'
> ---
> Changed since v5:
> - Add new __DISABLE_BUG_TABLE macro to prevent a build failure on those
> architectures which use atomics in pre-boot code like the EFI stub loader:
>
> x86_64-linux-gnu-ld: error: unplaced orphan section `__bug_table' from `arch/x86/boot/compressed/sev-handle-vc.o'

Urgh, so why not simply use __DISABLE_EXPORTS, that's typically (ab)used
for these things?

Also, unless __DISABLE_BUG_TABLE goes live inside asm/bug.h and kills
all __bug_table emissions, its a misnomer.

Furthermore, that SEV thing is broken and needs to be fixed anyway, this
isn't helping it much. noinstr code should not be using instrumented
things to begin with.