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

[Xen-devel] [PATCH] xen: Disable RAM-to-RAM copy in hvmemul_rep_movs() when mem_access_emulate_enabled


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
  • Date: Tue, 5 May 2015 13:01:22 +0300
  • Cc: andrew.cooper3@xxxxxxxxxx, keir@xxxxxxx, Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>, jbeulich@xxxxxxxx
  • Comment: DomainKeys? See http://domainkeys.sourceforge.net/
  • Delivery-date: Tue, 05 May 2015 10:01:55 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=yPHQM/stTzqpOU5FSaQRcXTWnrAFD8eD7qYdBOzAYolgKHaLzJGZU4ABWXNTYelF4dEJcZq0b5rdQcEc8pIE9kF2SngxZJgSaQCBu93eeMP5pMvrieaueAa6+PpYlOK2PbPgrnG1L4nX9sUiiR07wFK4dAtbG+/ippNRMm0erWfi/guk/wMV1WKWom4JXiEYZusHhXE84+tAxC/5dQU0ZZQ5uxDZaWVS1ccVKI6/MRbpy0DM0hAKv7TUlpWl3IIr/OeOqPmHixgyzvDLVJD5BgyYPZrrQSO6v7tix24y4NZlk+agU2/bheV4MCUkR1Fn5Y8mEwA2YySTaOp7lpSYJA==; 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>

The mem_access client might want to use hvm_emulate_one_no_write(),
in which case the RAM-to-RAM copy code in hvmemul_rep_movs() would
lead to an unwanted (and unexpected) write operation.

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

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 40de776..4cc7e01 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -951,6 +951,14 @@ static int hvmemul_rep_movs(
         return hvmemul_do_mmio(
             dgpa, reps, bytes_per_rep, sgpa, IOREQ_WRITE, df, NULL);
 
+    /*
+     * The mem_access client might want to call hvm_emulate_one_no_write(),
+     * in which case going ahead would lead to an unwanted write.
+     * Fall back to slow emulation instead.
+     */
+    if ( unlikely(current->domain->arch.mem_access_emulate_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


_______________________________________________
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®.