Skip to content
Snippets Groups Projects
user avatar
Waiman Long authored
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2090231


Conflcits: Fuzz in arch/x86/xen/xen-asm.S due to missing upstream
	   commit 09c41307 ("x86/xen: Make irq_disable() noinstr").

commit 5c8f6a2e
Author: Lai Jiangshan <laijs@linux.alibaba.com>
Date:   Fri, 26 Nov 2021 18:11:23 +0800

    x86/xen: Add xenpv_restore_regs_and_return_to_usermode()

    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.

    In that case, source and destination stacks are identical, which means
    that 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.

    This is dangerous as it can 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, with  XEN pv, 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.

     [ bp: Massage commit message. ]

    Fixes: 7f2590a1 ("x86/entry/64: Use a per-CPU trampoline stack for IDT entries")
Signed-off-by: default avatarLai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
    Link: https://lkml.kernel.org/r/20211126101209.8613-4-jiangshanlai@gmail.com



Signed-off-by: default avatarWaiman Long <longman@redhat.com>
788363b9
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.