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

[Xen-changelog] [xen staging] x86/altp2m: fix HVMOP_altp2m_set_domain_state race



commit 24d5282527f4647907b3572820b5335c15cd0356
Author:     Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
AuthorDate: Mon Feb 18 13:46:02 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Feb 18 13:46:02 2019 +0100

    x86/altp2m: fix HVMOP_altp2m_set_domain_state race
    
    HVMOP_altp2m_set_domain_state does not domain_pause(), presumably
    on purpose (as it was originally supposed to cater to a in-guest
    agent, and a domain pausing itself is not a good idea).
    
    This can lead to domain crashes in the vmx_vmexit_handler() code
    that checks if the guest has the ability to switch EPTP without an
    exit. That code can __vmread() the host p2m's EPT_POINTER
    (before HVMOP_altp2m_set_domain_state "for_each_vcpu()" has a
    chance to run altp2m_vcpu_initialise(), but after
    d->arch.altp2m_active is set).
    
    Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 410623d437..79c7d816e2 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4538,6 +4538,10 @@ static int do_altp2m_op(
             break;
         }
 
+        rc = domain_pause_except_self(d);
+        if ( rc )
+            break;
+
         ostate = d->arch.altp2m_active;
         d->arch.altp2m_active = !!a.u.domain_state.state;
 
@@ -4556,6 +4560,8 @@ static int do_altp2m_op(
             if ( ostate )
                 p2m_flush_altp2m(d);
         }
+
+        domain_unpause_except_self(d);
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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