[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V3 04/49] x86/xen: Add xenpv_restore_regs_and_return_to_usermode()
- To: Lai Jiangshan <jiangshanlai@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Sat, 16 Oct 2021 14:08:55 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aOlWC3Cw595G8TJ54yVSc2BzRIgENLvlwz77HvIGxqo=; b=Oku/rzWnHAwxVc9kqfFxYwy53k92yeeB2PaEjIGSlEHt9agUS3uv8fRygkpXtuBgzr5ISRHIWjtMASk+sTn4nhl1RgpWPSgeJbkUqqCuK39vyFoLTONNAgWcXgbyXmiUEXntkg94Gva7TisPNrVxKSl6E/Rzrd/ukHCWpn21WTumzOOVfCxu2j8ZyANewTd5ABHmLjrSJrup+hW8pFNztTyq7DXLqi1741cvqJ1ZjKmoGzC+4PpsZHgWqmtAOgcnFlbzaMgBl7nnYKvcyXDilEnJbq/1AM35aRiPpfZIaEsBKwyAEpX/+LUs+0PzW4OB/TEiDJiGZ2fv4SXve7eTDw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wa9G4ZY4VdEs1AyOc9SLUzoQrB0ZniP03YKB6pGkgSpD/yQC9YU3R1QdlMWt2qe4FCQNGsfWa7tBmevfT6YZseEjbBTyPSJ30yobReM+WzxqxspOVWIH4C4e3W0hug9Dl2fKLozDX1l8pteR6cA07XhYFhintoHbqfRO+942OYemlqT3Mq1GJSVb1w+MNl/vUEUMlNCYThriafmKV9dm+KBOY4CUoxWymRG9hPlYDO9dKnkgLPzKSD+E6xoAmR2p1QzE3wayFW615I+uG+6IkpwlRncyK3apitGl/Vk/CJSOIpS/MsaI9uoV8+ypiTwb0dQvv2Jyzjb5h8LAtW8Saw==
- Authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com;
- Cc: x86@xxxxxxxxxx, Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Peter Anvin <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Andy Lutomirski <luto@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Sat, 16 Oct 2021 18:09:29 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 10/13/21 11:13 PM, Lai Jiangshan wrote:
From: Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>
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@xxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: Peter Anvin <hpa@xxxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx>
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
|