Module Name:    src
Committed By:   martin
Date:           Tue May 24 17:30:01 UTC 2016

Modified Files:
        src/sys/kern: kern_pax.c

Log Message:
Effectively disable aslr for non-topdown-VA binaries (unless they are
compat32, which we deal with properly). It would be possible to get
those working too, but it is not worth the code complexity.

This makes binaries compiled with -mcmodel=medlow (and ancient binaries)
work again on sparc64, smoothing the upgrade path.

ok: christos


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_pax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.49 src/sys/kern/kern_pax.c:1.50
--- src/sys/kern/kern_pax.c:1.49	Sun May 22 14:26:09 2016
+++ src/sys/kern/kern_pax.c	Tue May 24 17:30:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.49 2016/05/22 14:26:09 christos Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.50 2016/05/24 17:30:01 martin 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.49 2016/05/22 14:26:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.50 2016/05/24 17:30:01 martin Exp $");
 
 #include "opt_pax.h"
 
@@ -454,6 +454,8 @@ pax_aslr_elf_flags_active(uint32_t flags
 static bool
 pax_aslr_epp_active(struct exec_package *epp)
 {
+	if (__predict_false((epp->ep_flags & (EXEC_32|EXEC_TOPDOWN_VM)) == 0))
+		return false;
 	return pax_flags_active(epp->ep_pax_flags, P_PAX_ASLR);
 }
 
@@ -469,6 +471,9 @@ pax_aslr_init_vm(struct lwp *l, struct v
 	if (!pax_aslr_active(l))
 		return;
 
+	if (__predict_false((ep->ep_flags & (EXEC_32|EXEC_TOPDOWN_VM)) == 0))
+		return;
+
 #ifdef PAX_ASLR_DEBUG
 	if (pax_aslr_flags & PAX_ASLR_MMAP)
 		return;

Reply via email to