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

[Xen-devel] [PATCH] xen: Disable emulate.c REP optimization if introspection is active


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
  • Date: Mon, 3 Nov 2014 11:39:38 +0200
  • Cc: keir@xxxxxxx, Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>, jbeulich@xxxxxxxx
  • Comment: DomainKeys? See http://domainkeys.sourceforge.net/
  • Delivery-date: Mon, 03 Nov 2014 09:40:18 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=SXiaUgVSKCDYhfMyrBekZjIqiSjD5obesEqc5WB0l3WWIrYQwlhVALXDnLhO7DGIa9phOXfgl/cMPkC1XaMqSnmQ9M0xzS6np+Mz7PSsMZZGoVCYeSan9aHtwBGgiel+PlyP/M6LFGX8an/cqKFsPDUnoBjof/cw34Vz/0j4J/ieSOECwhWDoiCkNS9BsH5EBJpA+XqCwxi50gjgv3rsZTmeUWh56cO46bE3rna6wNBc6fbDYnp1XX9t8hID04O4EM36TQL4LR9amPj54gJHxzUB7CLKh3NBLs7mBLqYIv4oclcPQi8e4lBLNnfw6gnDs1PPp58w5pcSo69eOsKC9A==; h=Received:Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:X-BitDefender-Scanner:X-BitDefender-Spam:X-BitDefender-SpamStamp:X-BitDefender-CF-Stamp;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Emulation for REP instructions is optimized to perform a single
write for all repeats in the current page if possible. However,
this interferes with a memory introspection application's ability
to detect suspect behaviour, since it will cause only one
mem_event to be sent per page touched.
This patch disables the optimization, gated on introspection
being active for the domain.

Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index c0f47d2..e53f390 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -395,6 +395,7 @@ static int hvmemul_virtual_to_linear(
 {
     struct segment_register *reg;
     int okay;
+    struct domain *currd = current->domain;
 
     if ( seg == x86_seg_none )
     {
@@ -402,12 +403,15 @@ static int hvmemul_virtual_to_linear(
         return X86EMUL_OKAY;
     }
 
-    /*
-     * Clip repetitions to avoid overflow when multiplying by @bytes_per_rep.
-     * The chosen maximum is very conservative but it's what we use in
-     * hvmemul_linear_to_phys() so there is no point in using a larger value.
-     */
-    *reps = min_t(unsigned long, *reps, 4096);
+    if ( currd->arch.hvm_domain.introspection_enabled )
+        *reps = 1;
+    else
+        /*
+         * Clip repetitions to avoid overflow when multiplying by 
@bytes_per_rep.
+         * The chosen maximum is very conservative but it's what we use in
+         * hvmemul_linear_to_phys() so there is no point in using a larger 
value.
+         */
+        *reps = min_t(unsigned long, *reps, 4096);
 
     reg = hvmemul_get_seg_reg(seg, hvmemul_ctxt);
 
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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