Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/x86 Although Xen's documentation states that th...



details:   https://anonhg.NetBSD.org/src/rev/e54ed045a63b
branches:  trunk
changeset: 752883:e54ed045a63b
user:      jym <jym%NetBSD.org@localhost>
date:      Tue Mar 09 23:12:06 2010 +0000

description:
Although Xen's documentation states that the address_bits field is not used
by XENMEM_decrease_reservation, it is checked by the hypervisor. In certain
circumstances (stack leak), the field could have an improper value, leading
to a fail of the hypercall.

Set it to 0 ("no addressing restriction") to avoid that.

Patch tested by Sam Fourman and haad@.

This should fix the rare "failed allocating DMA memory" encountered
under NetBSD dom0. Will ask for a pull-up.

diffstat:

 sys/arch/xen/x86/xen_bus_dma.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r df7d50062d30 -r e54ed045a63b sys/arch/xen/x86/xen_bus_dma.c
--- a/sys/arch/xen/x86/xen_bus_dma.c    Tue Mar 09 22:45:50 2010 +0000
+++ b/sys/arch/xen/x86/xen_bus_dma.c    Tue Mar 09 23:12:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xen_bus_dma.c,v 1.19 2010/03/02 00:13:50 jym Exp $     */
+/*     $NetBSD: xen_bus_dma.c,v 1.20 2010/03/09 23:12:06 jym Exp $     */
 /*     NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */
 
 /*-
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.19 2010/03/02 00:13:50 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.20 2010/03/09 23:12:06 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -95,6 +95,7 @@
                xenguest_handle(res.extent_start) = &mfn;
                res.nr_extents = 1;
                res.extent_order = 0;
+               res.address_bits = 0;
                res.domid = DOMID_SELF;
                error = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &res);
                if (error != 1) {



Home | Main Index | Thread Index | Old Index