Re: [PATCH v2 2/3] x86/entry/64: Use the TSS sp2 slot for SYSCALL/SYSRET scratch space

From: Borislav Petkov
Date: Fri Sep 07 2018 - 04:00:49 EST


On Mon, Sep 03, 2018 at 03:59:43PM -0700, Andy Lutomirski wrote:
> In the non-trampoline SYSCALL64 path, we use a percpu variable to
> temporarily store the user RSP value. Instead of a separate
> variable, use the otherwise unused sp2 slot in the TSS. This will
> improve cache locality, as the sp1 slot is already used in the same
> code to find the kernel stack. It will also simplify a future
> change to make the non-trampoline path work in PTI mode.
>
> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
> ---
> arch/x86/entry/entry_64.S | 16 +++++++++-------
> arch/x86/include/asm/processor.h | 6 ++++++
> arch/x86/kernel/asm-offsets.c | 3 ++-
> arch/x86/kernel/process_64.c | 2 --
> arch/x86/xen/xen-asm_64.S | 8 +++++---
> 5 files changed, 22 insertions(+), 13 deletions(-)

Reviewed-by: Borislav Petkov <bp@xxxxxxx>

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.