do not allow mappings above the top user address
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 11 Feb 1993 12:49:17 +0000 (04:49 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 11 Feb 1993 12:49:17 +0000 (04:49 -0800)
SCCS-vsn: sys/vm/vm_mmap.c 7.19

usr/src/sys/vm/vm_mmap.c

index 0999697..b3ef8b4 100644 (file)
@@ -11,7 +11,7 @@
  *
  * from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
  *
  *
  * from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
  *
- *     @(#)vm_mmap.c   7.18 (Berkeley) %G%
+ *     @(#)vm_mmap.c   7.19 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -179,6 +179,8 @@ smmap(p, uap, retval)
            ((uap->flags & MAP_ANON) && uap->fd != -1))
                return (EINVAL);
        size = (vm_size_t) round_page(uap->len);
            ((uap->flags & MAP_ANON) && uap->fd != -1))
                return (EINVAL);
        size = (vm_size_t) round_page(uap->len);
+       if ((uap->flags & MAP_FIXED) && (addr + size > VM_MAXUSER_ADDRESS))
+               return (EINVAL);
        /*
         * XXX if no hint provided for a non-fixed mapping place it after
         * the end of the largest possible heap.
        /*
         * XXX if no hint provided for a non-fixed mapping place it after
         * the end of the largest possible heap.