Source-Changes-HG archive

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

[src/trunk]: src/sys/kern For static PIE set the interpreter address to be th...



details:   https://anonhg.NetBSD.org/src/rev/039b6e59f18d
branches:  trunk
changeset: 827003:039b6e59f18d
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Oct 08 15:00:40 2017 +0000

description:
For static PIE set the interpreter address to be the entry offset so we
don't lose it.

diffstat:

 sys/kern/exec_elf.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r d082ea888dd9 -r 039b6e59f18d sys/kern/exec_elf.c
--- a/sys/kern/exec_elf.c       Sun Oct 08 14:03:46 2017 +0000
+++ b/sys/kern/exec_elf.c       Sun Oct 08 15:00:40 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_elf.c,v 1.90 2017/04/21 13:17:42 kamil Exp $      */
+/*     $NetBSD: exec_elf.c,v 1.91 2017/10/08 15:00:40 christos Exp $   */
 
 /*-
  * Copyright (c) 1994, 2000, 2005, 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.90 2017/04/21 13:17:42 kamil Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.91 2017/10/08 15:00:40 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -815,11 +815,12 @@
                interp = NULL;
        } else {
                epp->ep_entry = eh->e_entry;
-               if (epp->ep_flags & EXEC_FORCEAUX) {
-                       ap = kmem_alloc(sizeof(*ap), KM_SLEEP);
-                       ap->arg_interp = (vaddr_t)NULL;
-               } else
+               if (is_dyn || (epp->ep_flags & EXEC_FORCEAUX)) {
+                       ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
+                       ap->arg_interp = epp->ep_entryoffset;
+               } else {
                        ap = NULL;
+               }
        }
 
        if (ap) {



Home | Main Index | Thread Index | Old Index