Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm from the comment added to the code:



details:   https://anonhg.NetBSD.org/src/rev/923574f96d88
branches:  trunk
changeset: 474418:923574f96d88
user:      cgd <cgd%NetBSD.org@localhost>
date:      Tue Jul 06 02:31:05 1999 +0000

description:
from the comment added to the code:
> XXX (in)sanity check.  We don't do proper datasize checking
> XXX for anonymous (or private writable) mmap().  However,
> XXX know that if we're trying to allocate more than the amount
> XXX remaining under our current data size limit, _that_ should
> XXX be disallowed.
This is one link on the chain of lossage known as PR#7897.  It's
definitely not the right fix, but it's better than nothing.

diffstat:

 sys/uvm/uvm_mmap.c |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r 6ea0969c04e9 -r 923574f96d88 sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c        Tue Jul 06 02:15:53 1999 +0000
+++ b/sys/uvm/uvm_mmap.c        Tue Jul 06 02:31:05 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_mmap.c,v 1.27 1999/07/01 18:40:39 thorpej Exp $    */
+/*     $NetBSD: uvm_mmap.c,v 1.28 1999/07/06 02:31:05 cgd Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -510,6 +510,21 @@
        }
 
        /*
+        * XXX (in)sanity check.  We don't do proper datasize checking
+        * XXX for anonymous (or private writable) mmap().  However,
+        * XXX know that if we're trying to allocate more than the amount
+        * XXX remaining under our current data size limit, _that_ should
+        * XXX be disallowed.
+        */
+       if ((flags & MAP_ANON) != 0 ||
+           ((flags & MAP_PRIVATE) != 0 && (prot & PROT_WRITE) != 0)) {
+               if (size >
+                   (p->p_rlimit[RLIMIT_DATA].rlim_cur - ctob(p->p_vmspace->vm_dsize))) {
+                       return (ENOMEM);
+               }
+       }
+
+       /*
         * now let kernel internal function uvm_mmap do the work.
         */
 



Home | Main Index | Thread Index | Old Index