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

[xen master] x86/entry: fix jump into restore_all_guest without %rbx correctly set



commit c378ff8983cd69786c35117e49640f027e581bca
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Fri Jan 26 15:54:18 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Jan 26 19:07:30 2024 +0000

    x86/entry: fix jump into restore_all_guest without %rbx correctly set
    
    e047b8d0fa05 went too far when limiting obtaining the vCPU pointer.  While 
the
    code in ist_dispatch_done does indeed only need the vCPU pointer when PV32 
is
    enabled, the !PV32 path will end up jumping into restore_all_guest which 
does
    require rbx == vCPU pointer.
    
    Fix by moving the fetching of the vCPU pointer to be done outside of the 
PV32
    code block.
    
    Fixes: e047b8d0fa05 ('x86/entry: replace two GET_CURRENT() uses')
    Reported-by: Edwin Torok <edwin.torok@xxxxxxxxx>
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/x86_64/entry.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 44f25def86..ecdd6e5b47 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1139,8 +1139,9 @@ FUNC(handle_ist_exception)
         movl  $EVENT_CHECK_VECTOR,%edi
         call  send_IPI_self
 1:
-#ifdef CONFIG_PV32
+        /* For restore_all_guest. */
         mov   STACK_CPUINFO_FIELD(current_vcpu)(%r14), %rbx
+#ifdef CONFIG_PV32
         movq  VCPU_domain(%rbx),%rax
         cmpb  $0,DOMAIN_is_32bit_pv(%rax)
         je    restore_all_guest
--
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®.