xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/HVM: correct last address emulation acceptance check
@ 2016-04-26  8:22 Jan Beulich
  2016-04-26  8:37 ` Paul Durrant
  2016-04-26 10:33 ` Wei Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2016-04-26  8:22 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Wei Liu

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

For REPeated memory access instructions the repeat count also needs to
be considered. Utilize that "last" already takes this into account.

Also defer computing "last" until we really know we need it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/intercept.c
+++ b/xen/arch/x86/hvm/intercept.c
@@ -34,16 +34,16 @@
 static bool_t hvm_mmio_accept(const struct hvm_io_handler *handler,
                               const ioreq_t *p)
 {
-    paddr_t first = hvm_mmio_first_byte(p);
-    paddr_t last = hvm_mmio_last_byte(p);
+    paddr_t first = hvm_mmio_first_byte(p), last;
 
     BUG_ON(handler->type != IOREQ_TYPE_COPY);
 
     if ( !handler->mmio.ops->check(current, first) )
         return 0;
 
-    /* Make sure the handler will accept the whole access */
-    if ( p->size > 1 &&
+    /* Make sure the handler will accept the whole access. */
+    last = hvm_mmio_last_byte(p);
+    if ( last != first &&
          !handler->mmio.ops->check(current, last) )
         domain_crash(current->domain);
 




[-- Attachment #2: x86-HVM-MMIO-accept-rep.patch --]
[-- Type: text/plain, Size: 1123 bytes --]

x86/HVM: correct last address emulation acceptance check

For REPeated memory access instructions the repeat count also needs to
be considered. Utilize that "last" already takes this into account.

Also defer computing "last" until we really know we need it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/intercept.c
+++ b/xen/arch/x86/hvm/intercept.c
@@ -34,16 +34,16 @@
 static bool_t hvm_mmio_accept(const struct hvm_io_handler *handler,
                               const ioreq_t *p)
 {
-    paddr_t first = hvm_mmio_first_byte(p);
-    paddr_t last = hvm_mmio_last_byte(p);
+    paddr_t first = hvm_mmio_first_byte(p), last;
 
     BUG_ON(handler->type != IOREQ_TYPE_COPY);
 
     if ( !handler->mmio.ops->check(current, first) )
         return 0;
 
-    /* Make sure the handler will accept the whole access */
-    if ( p->size > 1 &&
+    /* Make sure the handler will accept the whole access. */
+    last = hvm_mmio_last_byte(p);
+    if ( last != first &&
          !handler->mmio.ops->check(current, last) )
         domain_crash(current->domain);
 

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

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

end of thread, other threads:[~2016-04-26 10:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26  8:22 [PATCH] x86/HVM: correct last address emulation acceptance check Jan Beulich
2016-04-26  8:37 ` Paul Durrant
2016-04-26 10:33 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).