[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <812bab88-81eb-485c-8b32-fb4a07784e12@citrix.com>
Date: Fri, 14 Mar 2025 23:56:47 +0000
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Uros Bizjak <ubizjak@...il.com>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 17/20] x86/smap: Use named asm operands in
smap_{save,restore}()
On 14/03/2025 10:51 pm, Andrew Cooper wrote:
> On 14/03/2025 9:41 pm, Josh Poimboeuf wrote:
>> @@ -50,9 +50,9 @@ static __always_inline unsigned long smap_save(void)
>> static __always_inline void smap_restore(unsigned long flags)
>> {
>> asm volatile ("# smap_restore\n\t"
>> - ALTERNATIVE("", "push %0; popf\n\t",
>> - X86_FEATURE_SMAP)
>> - : : "g" (flags) : "memory", "cc");
>> + ALTERNATIVE("",
>> + "push %[flags]; popf\n\t", X86_FEATURE_SMAP)
>> + : : [flags] "g" (flags) : "memory", "cc");
>> }
>>
>> /* These macros can be used in asm() statements */
> The problem with ASM_CALL_CONSTRAINT and asm_call() is that it's not
> just call instructions. It's any transient stack adjustment.
>
> Peeking forwards the other half of the series, you convert IRET to
> asm_call(), but leave these alone.
>
> These need converting, and hopefully someone can think of a better name
> than "call" to be used for the wrapper.
After chatting with Josh, the CALL aspect really is for unwinding
reasons. This will be fine, until the need for "redzone" arrives.
That said, through both series, there are definitely places which have
ASM_CALL_CONSTRAINT and oughtn't to.
~Andrew
Powered by blists - more mailing lists