Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Effectively disable aslr for non-topdown-VA binarie...



details:   https://anonhg.NetBSD.org/src/rev/6e88f6b455c4
branches:  trunk
changeset: 345397:6e88f6b455c4
user:      martin <martin%NetBSD.org@localhost>
date:      Tue May 24 17:30:01 2016 +0000

description:
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

diffstat:

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

diffs (37 lines):

diff -r a9601989403b -r 6e88f6b455c4 sys/kern/kern_pax.c
--- a/sys/kern/kern_pax.c       Tue May 24 17:11:14 2016 +0000
+++ b/sys/kern/kern_pax.c       Tue May 24 17:30:01 2016 +0000
@@ -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 @@
 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 @@
        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;



Home | Main Index | Thread Index | Old Index