VirtualBox

Ignore:
Timestamp:
Feb 14, 2018 7:58:57 AM (7 years ago)
Author:
vboxsync
Message:

VMM/HMSVMR0: Nested Hw.virt: Fix intercepting VMMCALL while executing the nested-guest (required for Hyper-V, KVM paravirt. nested VMs)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r70969 r71004  
    179179                                                         | SVM_CTRL_INTERCEPT_FERR_FREEZE \
    180180                                                         | SVM_CTRL_INTERCEPT_VMRUN       \
    181                                                          | SVM_CTRL_INTERCEPT_VMMCALL     \
    182181                                                         | SVM_CTRL_INTERCEPT_SKINIT      \
    183182                                                         | SVM_CTRL_INTERCEPT_WBINVD      \
     
    935934
    936935        /* Set up unconditional intercepts and conditions. */
    937         pVmcb->ctrl.u64InterceptCtrl = HMSVM_MANDATORY_GUEST_CTRL_INTERCEPTS;
     936        pVmcb->ctrl.u64InterceptCtrl =   HMSVM_MANDATORY_GUEST_CTRL_INTERCEPTS
     937                                       | SVM_CTRL_INTERCEPT_VMMCALL;
    938938
    939939        /* CR0, CR4 reads must be intercepted, our shadow values are not necessarily the same as the guest's. */
     
    20032003        pVmcbNstGst->ctrl.u16InterceptWrDRx |= 0xffff;
    20042004
    2005         /* Exclude the VINTR intercept of the outer guest as we don't need to cause VINTR #VMEXITs
    2006            that belong to the nested-guest to the outer guest. */
     2005        /*
     2006         * Adjust intercepts while executing the nested-guest that differ from the
     2007         * outer guest intercepts.
     2008         *
     2009         * - VINTR: Exclude the outer guest intercept as we don't need to cause VINTR #VMEXITs
     2010         *   that belong to the nested-guest to the outer guest.
     2011         *
     2012         * - VMMCALL: Exclude the outer guest intercept as when it's also not intercepted by
     2013         *   the nested-guest, the physical CPU raises a \#UD exception as expected.
     2014         */
    20072015        pVmcbNstGst->ctrl.u32InterceptXcpt  |= pVmcb->ctrl.u32InterceptXcpt;
    2008         pVmcbNstGst->ctrl.u64InterceptCtrl  |= (pVmcb->ctrl.u64InterceptCtrl & ~SVM_CTRL_INTERCEPT_VINTR)
     2016        pVmcbNstGst->ctrl.u64InterceptCtrl  |= (pVmcb->ctrl.u64InterceptCtrl & (  ~SVM_CTRL_INTERCEPT_VINTR
     2017                                                                                | ~SVM_CTRL_INTERCEPT_VMMCALL))
    20092018                                            |  HMSVM_MANDATORY_GUEST_CTRL_INTERCEPTS;
    20102019
    2011         /*
    2012          * Adjust control intercepts while executing the nested-guest that differ
    2013          * from the outer guest intercepts.
    2014          *
    2015          * VMMCALL when not intercepted raises a \#UD exception in the guest. However,
    2016          * other SVM instructions like VMSAVE when not intercept can cause havoc on the
    2017          * host as they can write to any location in physical memory, hence they always
    2018          * need to be intercepted (see below).
    2019          */
    20202020        Assert(   (pVmcbNstGst->ctrl.u64InterceptCtrl & HMSVM_MANDATORY_GUEST_CTRL_INTERCEPTS)
    20212021               == HMSVM_MANDATORY_GUEST_CTRL_INTERCEPTS);
    2022         pVmcbNstGst->ctrl.u64InterceptCtrl  &= ~SVM_CTRL_INTERCEPT_VMMCALL;
    20232022
    20242023        /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette