Skip to content

Commit db5b2c5

Browse files
amlutoKAGA-KOKO
authored andcommitted
x86/entry/compat: Clear RAX high bits on Xen PV SYSENTER
Move the clearing of the high bits of RAX after Xen PV joins the SYSENTER path so that Xen PV doesn't skip it. Arguably this code should be deleted instead, but that would belong in the merge window. Fixes: ffae641 ("x86/entry/64/compat: Fix Xen PV SYSENTER frame setup") Signed-off-by: Andy Lutomirski <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/9d33b3f3216dcab008070f1c28b6091ae7199969.1593795633.git.luto@kernel.org
1 parent cced0b2 commit db5b2c5

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

arch/x86/entry/entry_64_compat.S

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ SYM_CODE_START(entry_SYSENTER_compat)
5757

5858
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
5959

60-
/*
61-
* User tracing code (ptrace or signal handlers) might assume that
62-
* the saved RAX contains a 32-bit number when we're invoking a 32-bit
63-
* syscall. Just in case the high bits are nonzero, zero-extend
64-
* the syscall number. (This could almost certainly be deleted
65-
* with no ill effects.)
66-
*/
67-
movl %eax, %eax
68-
6960
/* Construct struct pt_regs on stack */
7061
pushq $__USER32_DS /* pt_regs->ss */
7162
pushq $0 /* pt_regs->sp = 0 (placeholder) */
@@ -80,6 +71,16 @@ SYM_CODE_START(entry_SYSENTER_compat)
8071
pushq $__USER32_CS /* pt_regs->cs */
8172
pushq $0 /* pt_regs->ip = 0 (placeholder) */
8273
SYM_INNER_LABEL(entry_SYSENTER_compat_after_hwframe, SYM_L_GLOBAL)
74+
75+
/*
76+
* User tracing code (ptrace or signal handlers) might assume that
77+
* the saved RAX contains a 32-bit number when we're invoking a 32-bit
78+
* syscall. Just in case the high bits are nonzero, zero-extend
79+
* the syscall number. (This could almost certainly be deleted
80+
* with no ill effects.)
81+
*/
82+
movl %eax, %eax
83+
8384
pushq %rax /* pt_regs->orig_ax */
8485
pushq %rdi /* pt_regs->di */
8586
pushq %rsi /* pt_regs->si */

0 commit comments

Comments
 (0)