Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern simplify.
details: https://anonhg.NetBSD.org/src/rev/8ae96a0f1edf
branches: trunk
changeset: 344293:8ae96a0f1edf
user: christos <christos%NetBSD.org@localhost>
date: Sun Mar 20 16:39:36 2016 +0000
description:
simplify.
diffstat:
sys/kern/kern_pax.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diffs (58 lines):
diff -r 85c9197614aa -r 8ae96a0f1edf sys/kern/kern_pax.c
--- a/sys/kern/kern_pax.c Sun Mar 20 16:26:06 2016 +0000
+++ b/sys/kern/kern_pax.c Sun Mar 20 16:39:36 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_pax.c,v 1.35 2016/03/20 14:58:10 khorben Exp $ */
+/* $NetBSD: kern_pax.c,v 1.36 2016/03/20 16:39:36 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.35 2016/03/20 14:58:10 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.36 2016/03/20 16:39:36 christos Exp $");
#include "opt_pax.h"
@@ -86,7 +86,6 @@
#ifdef PAX_ASLR
#include <sys/mman.h>
-#include <compat/netbsd32/netbsd32.h>
int pax_aslr_enabled = 1;
int pax_aslr_global = PAX_ASLR;
@@ -97,6 +96,9 @@
#ifndef PAX_ASLR_DELTA_MMAP_LEN
#define PAX_ASLR_DELTA_MMAP_LEN ((sizeof(void *) * NBBY) / 2)
#endif
+#ifndef PAX_ASLR_DELTA_MMAP_LEN32
+#define PAX_ASLR_DELTA_MMAP_LEN32 ((sizeof(uint32_t) * NBBY) / 2)
+#endif
#ifndef PAX_ASLR_DELTA_STACK_LSB
#define PAX_ASLR_DELTA_STACK_LSB PGSHIFT
#endif
@@ -405,14 +407,13 @@
if (!pax_aslr_active(l))
return;
- if (ep->ep_flags & EXEC_32)
- vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(cprng_fast32(),
- PAX_ASLR_DELTA_MMAP_LSB,
- (sizeof(netbsd32_pointer_t) * NBBY) / 2);
- else
- vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(cprng_fast32(),
- PAX_ASLR_DELTA_MMAP_LSB, PAX_ASLR_DELTA_MMAP_LEN);
- PAX_DPRINTF("delta_mmap=%#jx", vm->vm_aslr_delta_mmap);
+ uint32_t len = (ep->ep_flags & EXEC_32) ?
+ PAX_ASLR_DELTA_MMAP_LEN32 : PAX_ASLR_DELTA_MMAP_LEN;
+
+ vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(cprng_fast32(),
+ PAX_ASLR_DELTA_MMAP_LSB, len);
+
+ PAX_DPRINTF("delta_mmap=%#jx/%u", vm->vm_aslr_delta_mmap, len);
}
void
Home |
Main Index |
Thread Index |
Old Index