Module Name: src
Committed By: maxv
Date: Wed Aug 5 15:58:01 UTC 2015
Modified Files:
src/sys/kern: exec_elf.c
Log Message:
stupid comment, and make sure we are not executing a lib
To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.74 src/sys/kern/exec_elf.c:1.75
--- src/sys/kern/exec_elf.c:1.74 Tue Aug 4 18:28:09 2015
+++ src/sys/kern/exec_elf.c Wed Aug 5 15:58:01 2015
@@ -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 @@ exec_elf_makecmds(struct lwp *l, struct
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 @@ exec_elf_makecmds(struct lwp *l, struct
}
}
+ 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.