Source-Changes-HG archive

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

[src/trunk]: src/sys/kern stupid comment, and make sure we are not executing ...



details:   https://anonhg.NetBSD.org/src/rev/6627377389f2
branches:  trunk
changeset: 339719:6627377389f2
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Aug 05 15:58:01 2015 +0000

description:
stupid comment, and make sure we are not executing a lib

diffstat:

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

diffs (43 lines):

diff -r 0ffdef0648b7 -r 6627377389f2 sys/kern/exec_elf.c
--- a/sys/kern/exec_elf.c       Wed Aug 05 12:28:47 2015 +0000
+++ b/sys/kern/exec_elf.c       Wed Aug 05 15:58:01 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_elf.c,v 1.74 2015/08/04 18:28:09 maxv Exp $       */
+/*     $NetBSD: exec_elf.c,v 1.75 2015/08/05 15:58:01 maxv Exp $       */
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.74 2015/08/04 18:28:09 maxv Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.75 2015/08/05 15:58:01 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -646,10 +646,7 @@
                return error;
 
        if (eh->e_type == ET_DYN)
-               /*
-                * XXX allow for executing shared objects. It seems silly
-                * but other ELF-based systems allow it as well.
-                */
+               /* PIE */
                is_dyn = true;
        else if (eh->e_type != ET_EXEC)
                return ENOEXEC;
@@ -695,6 +692,12 @@
                }
        }
 
+       if (is_dyn && (interp == NULL)) {
+               /* PIEs must have an interpreter */
+               error = ENOEXEC;
+               goto bad;
+       }
+
        /*
         * On the same architecture, we may be emulating different systems.
         * See which one will accept this executable.



Home | Main Index | Thread Index | Old Index