Re: Build breakage caused by the use of UDB

From: Brian Gerst
Date: Thu Dec 18 2025 - 07:39:14 EST


On Thu, Dec 18, 2025 at 5:48 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Thu, Dec 18, 2025 at 11:38:53AM +0100, Peter Zijlstra wrote:
> > On Thu, Dec 18, 2025 at 11:26:13AM +0100, Uros Bizjak wrote:
> >
> > > I see... OTOH, a trivial solution would be to just use "ud2" mnemonic,
> > > as proposed in [1].
> > >
> > > [1] https://lore.kernel.org/lkml/20250909100038.1709394-1-ubizjak@xxxxxxxxx/
> >
> > Yes, there is that. I suppose I worry about all the other _ASM_BYTES
> > users, but since they don't actually show miscompilation, perhaps I
> > should not worry.
> >
> > Let me do a build with just using ud2 instead.
>
> Yep, this builds. Let me stick a changelog on with Fixes and Cc stable
> and stick it in x86/urgent.
>
> ---
>
> diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
> index d561a8443c13..9b4e04690e1a 100644
> --- a/arch/x86/include/asm/bug.h
> +++ b/arch/x86/include/asm/bug.h
> @@ -15,7 +15,7 @@ extern void __WARN_trap(struct bug_entry *bug, ...);
> /*
> * Despite that some emulators terminate on UD2, we use it for WARN().
> */
> -#define ASM_UD2 _ASM_BYTES(0x0f, 0x0b)
> +#define ASM_UD2 __ASM_FORM(ud2)
> #define INSN_UD2 0x0b0f
> #define LEN_UD2 2
>
>

Replace all instances of ASM_UD2 with the instruction. There is no
need to keep it now.


Brian Gerst