diff options
| author | dsl <dsl@NetBSD.org> | 2007-04-22 08:29:55 +0000 |
|---|---|---|
| committer | dsl <dsl@NetBSD.org> | 2007-04-22 08:29:55 +0000 |
| commit | b8fbaf8c4be690d029da1be20006f487e2f81b17 (patch) | |
| tree | 68186d3317175dfd95f7baa39a60030c8364e661 /sys/kern/exec_script.c | |
| parent | 98e922db67056a5d00e1de9d956eb8f21f649172 (diff) | |
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
Diffstat (limited to 'sys/kern/exec_script.c')
| -rw-r--r-- | sys/kern/exec_script.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c index 76c44e54b49..130f4f8ab12 100644 --- a/sys/kern/exec_script.c +++ b/sys/kern/exec_script.c @@ -1,4 +1,4 @@ -/* $NetBSD: exec_script.c,v 1.56 2007/03/04 06:03:02 christos Exp $ */ +/* $NetBSD: exec_script.c,v 1.57 2007/04/22 08:30:00 dsl Exp $ */ /* * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.56 2007/03/04 06:03:02 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.57 2007/04/22 08:30:00 dsl Exp $"); #if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS) #define FDSCRIPTS /* Need this for safe set-id scripts. */ @@ -272,10 +272,10 @@ check_shell: scriptvp = epp->ep_vp; oldpnbuf = epp->ep_ndp->ni_cnd.cn_pnbuf; - if ((error = check_exec(l, epp)) == 0) { - /* note that we've clobbered the header */ - epp->ep_flags |= EXEC_DESTR|EXEC_HASES; - + error = check_exec(l, epp); + /* note that we've clobbered the header */ + epp->ep_flags |= EXEC_DESTR; + if (error == 0) { /* * It succeeded. Unlock the script and * close it if we aren't using it any more. @@ -314,8 +314,6 @@ check_shell: #ifdef FDSCRIPTS fail: #endif - /* note that we've clobbered the header */ - epp->ep_flags |= EXEC_DESTR; /* kill the opened file descriptor, else close the file */ if (epp->ep_flags & EXEC_HASFD) { |
