[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhGHyBHPDD=hD-78rQDCj2VfQT21m8JzD-m9DazsUa8VpBVcQ@mail.gmail.com>
Date: Fri, 29 Apr 2022 19:45:43 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Jürgen Gross <jgross@...e.com>,
LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, X86 ML <x86@...nel.org>,
Lai Jiangshan <jiangshan.ljs@...group.com>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
"Kirill A. Shutemov" <kirill@...temov.name>
Subject: Re: [PATCH V6 6/8] x86/entry: Convert SWAPGS to swapgs and remove the
definition of SWAPGS
On Fri, Apr 29, 2022 at 5:56 PM Borislav Petkov <bp@...en8.de> wrote:
>
> On Thu, Apr 21, 2022 at 10:10:53PM +0800, Lai Jiangshan wrote:
> > diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
> > index 4fdb007cddbd..c5aeb0819707 100644
> > --- a/arch/x86/entry/entry_64_compat.S
> > +++ b/arch/x86/entry/entry_64_compat.S
> > @@ -50,7 +50,7 @@ SYM_CODE_START(entry_SYSENTER_compat)
> > UNWIND_HINT_EMPTY
> > ENDBR
> > /* Interrupts are off on entry. */
> > - SWAPGS
> > + swapgs
> >
> > pushq %rax
> > SWITCH_TO_KERNEL_CR3 scratch_reg=%rax
>
> I'm not sure about this: why can't XENPV do a 32-bit syscall through the vdso?
>
> Also, looking at this, Jürgen, it looks kinda spaghetti to me:
>
> entry_SYSENTER_compat
>
> ...
>
> /* XEN PV guests always use IRET path */
> ALTERNATIVE "testl %eax, %eax; jz swapgs_restore_regs_and_return_to_usermode", \
> "jmp swapgs_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV
>
>
> then at that swapgs_restore_regs_and_return_to_usermode label:
>
> #ifdef CONFIG_XEN_PV
> ALTERNATIVE "", "jmp xenpv_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV
> #endif
>
>
> Can we simply jump directly to xenpv_restore_regs_and_return_to_usermode
> from entry_SYSENTER_compat or is that CONFIG_DEBUG_ENTRY chunk there
> needed?
Hello
Adding ALTERNATIVE in swapgs_restore_regs_and_return_to_usermode()
results a simpler patch which is better served as a bug fix:
https://lore.kernel.org/lkml/163861832551.11128.1645285137833652414.tip-bot2@tip-bot2/
which is also your suggestion:
https://lore.kernel.org/lkml/YYD9ohN2Zcy4EdMb@zn.tnic/
While the original patch has sprinkled all those ALTERNATIVE calls
everywhere:
https://lore.kernel.org/lkml/20211026141420.17138-5-jiangshanlai@gmail.com/
And this original version has a SYM_L_WEAK placeholder
which is objected to by some people.
Thanks
Lai
Powered by blists - more mailing lists