[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86/PV: use 64-bit subtract to adjust guest RIP upon missing SYSCALL callbacks



commit 464301737acfa90b46b79659b19d7f456861def3
Author:     Jan Beulich <JBeulich@xxxxxxxx>
AuthorDate: Wed Jan 27 08:47:13 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 27 08:47:13 2021 +0100

    x86/PV: use 64-bit subtract to adjust guest RIP upon missing SYSCALL 
callbacks
    
    When discussing the shrunk down version of the commit in question it
    was said (in reply to my conditional choosing of the width):
    
    "However, the 32bit case isn't actually interesting here.  A
     guest can't execute a SYSCALL instruction on/across the 4G->0 boundary
     because the M2P is mapped NX up to the 4G boundary, so we can never
     reach this point with %eip < 2.
    
     Therefore, the 64bit-only form is the appropriate one to use, which
     solves any question of cleverness, or potential decode stalls it
     causes."
    
    Fixes: ca6fcf4321b3 ("x86/pv: Inject #UD for missing SYSCALL callbacks")
    Signed-off-by: Jan Beulich <JBeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/x86_64/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index b5688e2c34..6422687fbf 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -42,7 +42,7 @@ ENTRY(switch_to_kernel)
 UNLIKELY_START(z, syscall_no_callback) /* TB_eip == 0 => #UD */
         mov   VCPU_trap_ctxt(%rbx), %rdi
         movl  $X86_EXC_UD, UREGS_entry_vector(%rsp)
-        subl  $2, UREGS_rip(%rsp)
+        subq  $2, UREGS_rip(%rsp)
         mov   X86_EXC_UD * TRAPINFO_sizeof + TRAPINFO_eip(%rdi), %rax
         testb $4, X86_EXC_UD * TRAPINFO_sizeof + TRAPINFO_flags(%rdi)
         setnz %cl
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.