summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2003-08-21 18:56:07 +0000
committertedu <tedu@openbsd.org>2003-08-21 18:56:07 +0000
commite20a449d57f00d291866ed3def56b4ad4b4b2b15 (patch)
treee4c1ba408a1da199a7f5d407b6159f680564c9a7 /sys/kern/kern_exec.c
parentfix the offsets in decoding byte rom dd (verified per manual); miod@ ok (diff)
downloadwireguard-openbsd-e20a449d57f00d291866ed3def56b4ad4b4b2b15.tar.xz
wireguard-openbsd-e20a449d57f00d291866ed3def56b4ad4b4b2b15.zip
emulation is now controlled by sysctl. changes:
add e_flags to struct emul. this stores on/off and native flags. check for emul enabled in check_exec(). gather all the emuls into a emulsw so a sysctl can find them. create sysctl. move maxhdrsiz calcualation into init_main so it cleans up sys_execve codepath. teach sysctl utility to grok kern.emul hierarchy. requested and ok deraadt@ some comments from mickey@
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index af4347fbfe7..8be38c028df 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.80 2003/06/21 00:42:58 tedu Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.81 2003/08/21 18:56:07 tedu Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -175,6 +175,8 @@ check_exec(p, epp)
if (execsw[i].es_check == NULL)
continue;
newerror = (*execsw[i].es_check)(p, epp);
+ if (!newerror && !(epp->ep_emul->e_flags & EMUL_ENABLED))
+ newerror = ENOEXEC;
/* make sure the first "interesting" error code is saved. */
if (!newerror || error == ENOEXEC)
error = newerror;
@@ -235,7 +237,7 @@ sys_execve(p, v, retval)
syscallarg(char * *) argp;
syscallarg(char * *) envp;
} */ *uap = v;
- int error, i;
+ int error;
struct exec_package pack;
struct nameidata nid;
struct vattr attr;
@@ -259,18 +261,6 @@ sys_execve(p, v, retval)
*/
p->p_flag |= P_INEXEC;
- /*
- * figure out the maximum size of an exec header, if necessary.
- * XXX should be able to keep LKM code from modifying exec switch
- * when we're still using it, but...
- */
- if (exec_maxhdrsz == 0) {
- for (i = 0; i < nexecs; i++)
- if (execsw[i].es_check != NULL
- && execsw[i].es_hdrsz > exec_maxhdrsz)
- exec_maxhdrsz = execsw[i].es_hdrsz;
- }
-
/* init the namei data to point the file user's program name */
NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);