Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Hook to clamp the random value for mmap for machies...



details:   https://anonhg.NetBSD.org/src/rev/726ce0618c50
branches:  trunk
changeset: 345285:726ce0618c50
user:      christos <christos%NetBSD.org@localhost>
date:      Tue May 17 00:38:50 2016 +0000

description:
Hook to clamp the random value for mmap for machies that don't have enough
VA bits.

diffstat:

 sys/kern/kern_pax.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r b18df91e1e00 -r 726ce0618c50 sys/kern/kern_pax.c
--- a/sys/kern/kern_pax.c       Mon May 16 22:20:10 2016 +0000
+++ b/sys/kern/kern_pax.c       Tue May 17 00:38:50 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_pax.c,v 1.45 2016/05/14 17:04:09 christos Exp $   */
+/*     $NetBSD: kern_pax.c,v 1.46 2016/05/17 00:38:50 christos Exp $   */
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.45 2016/05/14 17:04:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.46 2016/05/17 00:38:50 christos Exp $");
 
 #include "opt_pax.h"
 
@@ -482,6 +482,9 @@
        if (pax_aslr_flags & PAX_ASLR_FIXED)
                rand = pax_aslr_rand;
 #endif
+#ifdef PAX_ASLR_RAND_MMAP_MAX
+       rand &= PAX_ASLR_RAND_MMAP_MAX - 1;
+#endif
        vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(rand,
            PAX_ASLR_DELTA_MMAP_LSB, len);
 



Home | Main Index | Thread Index | Old Index