Skip to contentSkip to conversation

xen/svm: don't clear interception for MSRs required for introspection

PATCH Superseded Razvan Cojocaru 2 participants 3 messages May 25, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/svm: don't clear interception for MSRs required for introspection

This patch mirrors the VMX code that doesn't allow vmx_disable_intercept_for_msr() to clear interception of MSRs that an introspection agent is trying to monitor.

---
 xen/arch/x86/hvm/svm/svm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/svm/svm.c +3 -2
index 673a38c..d313b3f 100644
@@ -148,6 +148,7 @@ svm_msrbit(unsigned long *msr_bitmap, uint32_t msr)
 void svm_intercept_msr(struct vcpu *v, uint32_t msr, int flags)
 {
     unsigned long *msr_bit;
+    const struct domain *d = v->domain;
 
     msr_bit = svm_msrbit(v->arch.hvm_svm.msrpm, msr);
     BUG_ON(msr_bit == NULL);
@@ -155,12 +156,12 @@ void svm_intercept_msr(struct vcpu *v, uint32_t msr, int flags)
 
     if ( flags & MSR_INTERCEPT_READ )
          __set_bit(msr * 2, msr_bit);
-    else
+    else if ( !monitored_msr(d, msr) )
          __clear_bit(msr * 2, msr_bit);
 
     if ( flags & MSR_INTERCEPT_WRITE )
         __set_bit(msr * 2 + 1, msr_bit);
-    else
+    else if ( !monitored_msr(d, msr) )
         __clear_bit(msr * 2 + 1, msr_bit);
 }
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Razvan Cojocaru

This patch mirrors the VMX code that doesn't allow vmx_disable_intercept_for_msr()

vmx_clear_msr_intercept() ?

Quoted 4 lines

to clear interception of MSRs that
an introspection agent is trying to monitor.

With that fixed,

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 6 lines · Boris Ostrovsky
Quoted 2 lines · Razvan Cojocaru

This patch mirrors the VMX code that doesn't allow vmx_disable_intercept_for_msr()

vmx_clear_msr_intercept() ?

Quoted 8 lines
Quoted 4 lines

to clear interception of MSRs that
an introspection agent is trying to monitor.

With that fixed,

Apologies, you're right. I was looking at the original patch, where there's vmx_disable_intercept_for_msr():

https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=490a39a1dbc7406776344f36e1b27c33c2ada63d

I'll submit V2 with that corrected (unless it's preferrable for that to be changed on commit?).

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel