Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Allow MD code to add aditional checks for mmap(..., ...



details:   https://anonhg.NetBSD.org/src/rev/85fb508c1647
branches:  trunk
changeset: 789867:85fb508c1647
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Sep 11 18:26:14 2013 +0000

description:
Allow MD code to add aditional checks for mmap(..., MAP_FIXED) address
ranges. This can be used, for example, to avoid not implemented VA-holes,
but we probably need to check in a few more places.

diffstat:

 sys/uvm/uvm_mmap.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r c415964c8775 -r 85fb508c1647 sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c        Wed Sep 11 12:59:19 2013 +0000
+++ b/sys/uvm/uvm_mmap.c        Wed Sep 11 18:26:14 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_mmap.c,v 1.144 2012/01/27 19:48:41 para Exp $      */
+/*     $NetBSD: uvm_mmap.c,v 1.145 2013/09/11 18:26:14 martin Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.144 2012/01/27 19:48:41 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.145 2013/09/11 18:26:14 martin Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_pax.h"
@@ -88,6 +88,7 @@
        vaddr_t vm_min_address = VM_MIN_ADDRESS;
        vaddr_t vm_max_address = VM_MAXUSER_ADDRESS;
        vaddr_t eaddr = addr + size;
+       int res = 0;
 
        if (addr < vm_min_address)
                return EINVAL;
@@ -95,7 +96,12 @@
                return ismmap ? EFBIG : EINVAL;
        if (addr > eaddr) /* no wrapping! */
                return ismmap ? EOVERFLOW : EINVAL;
-       return 0;
+
+#ifdef MD_MMAP_RANGE_TEST
+       res = MD_MMAP_RANGE_TEST(addr, eaddr);
+#endif
+
+       return res;
 }
 
 /*



Home | Main Index | Thread Index | Old Index