lkml.org 
[lkml]   [2021]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH V3 04/49] x86/xen: Add xenpv_restore_regs_and_return_to_usermode()
    From

    On 10/13/21 11:13 PM, Lai Jiangshan wrote:
    > From: Lai Jiangshan <laijs@linux.alibaba.com>
    >
    > While in the native case, PER_CPU_VAR(cpu_tss_rw + TSS_sp0) is the
    > trampoline stack. But XEN pv doesn't use trampoline stack, so
    > PER_CPU_VAR(cpu_tss_rw + TSS_sp0) is also the kernel stack. Hence source
    > and destination stacks are identical in that case, which means reusing
    > swapgs_restore_regs_and_return_to_usermode() in XEN pv would cause %rsp
    > to move up to the top of the kernel stack and leave the IRET frame below
    > %rsp, which is dangerous to be corrupted if #NMI / #MC hit as either of
    > these events occurring in the middle of the stack pushing would clobber
    > data on the (original) stack.
    >
    > And swapgs_restore_regs_and_return_to_usermode() pushing the IRET frame
    > on to the original address is useless and error-prone when there is any
    > future attempt to modify the code.
    >
    > Fixes: 7f2590a110b8 ("x86/entry/64: Use a per-CPU trampoline stack for IDT entries")
    > Cc: Jan Beulich <jbeulich@suse.com>
    > Cc: Thomas Gleixner <tglx@linutronix.de>
    > Cc: Juergen Gross <jgross@suse.com>
    > Cc: Peter Anvin <hpa@zytor.com>
    > Cc: xen-devel@lists.xenproject.org>
    > Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    > Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>


    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>


    \
     
     \ /
      Last update: 2021-10-16 20:11    [W:3.930 / U:0.440 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site