All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: Disable REP MOVSD optimization if introspection is active
@ 2014-10-27 10:37 Razvan Cojocaru
  2014-10-27 10:50 ` Andrew Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Razvan Cojocaru @ 2014-10-27 10:37 UTC (permalink / raw)
  To: xen-devel; +Cc: keir, Razvan Cojocaru, jbeulich

REP MOVSD emulation is optimized to write several pages at once
if possible. While this is a very good thing in general, it
can interfere with a memory introspection application's ability
to detect suspect behaviour, since it supresses potentially
telling future page faults. This patch disables the optimization,
gated on introspection being active for the domain.

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
 xen/arch/x86/hvm/emulate.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index c0f47d2..1848a33 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -885,6 +885,7 @@ static int hvmemul_rep_movs(
     p2m_type_t sp2mt, dp2mt;
     int rc, df = !!(ctxt->regs->eflags & X86_EFLAGS_DF);
     char *buf;
+    struct domain *currd = current->domain;
 
     rc = hvmemul_virtual_to_linear(
         src_seg, src_offset, bytes_per_rep, reps, hvm_access_read,
@@ -928,6 +929,10 @@ static int hvmemul_rep_movs(
         return hvmemul_do_mmio(
             dgpa, reps, bytes_per_rep, sgpa, IOREQ_WRITE, df, NULL);
 
+    /* Fall back to slow emulation if introspection is enabled. */
+    if ( currd->arch.hvm_domain.introspection_enabled )
+        return X86EMUL_UNHANDLEABLE;
+
     /* RAM-to-RAM copy: emulate as equivalent of memmove(dgpa, sgpa, bytes). */
     bytes = *reps * bytes_per_rep;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-10-27 13:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-27 10:37 [PATCH] xen: Disable REP MOVSD optimization if introspection is active Razvan Cojocaru
2014-10-27 10:50 ` Andrew Cooper
2014-10-27 11:09   ` Razvan Cojocaru
2014-10-27 11:14     ` Andrew Cooper
2014-10-27 13:01     ` Jan Beulich
2014-10-27 13:33       ` Razvan Cojocaru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.