lkml.org 
[lkml]   [2022]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V6 7/8] x86/entry: Remove the branch in sync_regs()
Date
From: Lai Jiangshan <jiangshan.ljs@antgroup.com>

In non-XENPV, the tss.sp0 is always the trampoline stack, and
sync_regs() is called on non-XENPV only since error_entry() is not
called on XENPV, so the stack must be the trampoline stack or one of
the IST stack if it is from user mode or bad iret.

Remove the check in sync_regs() and always copy the pt_regs from the
stack in the cpu entry area to the task stack.

Cc: Juergen Gross <jgross@suse.com>
Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
---
arch/x86/kernel/traps.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 111b18d57a54..e1cb4c009d54 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -845,13 +845,13 @@ DEFINE_IDTENTRY_RAW(exc_int3)
/*
* Help handler running on a per-cpu (IST or entry trampoline) stack
* to switch to the normal thread stack if the interrupted code was in
- * user mode. The actual stack switch is done in entry_64.S
+ * user mode. The actual stack switch is done in entry_64.S.
*/
asmlinkage __visible noinstr struct pt_regs *sync_regs(struct pt_regs *eregs)
{
struct pt_regs *regs = (struct pt_regs *)this_cpu_read(cpu_current_top_of_stack) - 1;
- if (regs != eregs)
- *regs = *eregs;
+
+ *regs = *eregs;
return regs;
}

--
2.19.1.6.gb485710b
\
 
 \ /
  Last update: 2022-04-21 16:12    [W:0.131 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site