Re: [PATCH V2 9/9] x86/speculation: Remove all ANNOTATE_NOSPEC_ALTERNATIVE directives

From: Peter Zijlstra
Date: Tue Apr 07 2020 - 13:26:42 EST


On Tue, Apr 07, 2020 at 07:01:43PM +0200, Alexandre Chartre wrote:

> I think that's the case with smap_save:
>
> static __always_inline unsigned long smap_save(void)
> {
> unsigned long flags;
>
> asm volatile (ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC,
> X86_FEATURE_SMAP)
> : "=rm" (flags) : : "memory", "cc");
>
> return flags;
> }
>
> The alternative does change the stack but objtool won't complain
> because it handles the pushf and pop instruction.

Oh bugger; indeed! That'll wreck unwinding.