Do not call namei anymore, but use the result from the previous

emul_find_interp call instead. This make dynamic executables work
again under compat OSF1 (fix PR/39255).

ok by christos.
This commit is contained in:
njoly 2008-11-15 00:49:53 +00:00
parent 13de59a192
commit ef05808702

View File

@ -1,4 +1,4 @@
/* $NetBSD: osf1_exec_ecoff.c,v 1.20 2007/12/09 13:34:24 dogcow Exp $ */ /* $NetBSD: osf1_exec_ecoff.c,v 1.21 2008/11/15 00:49:53 njoly Exp $ */
/* /*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_exec_ecoff.c,v 1.20 2007/12/09 13:34:24 dogcow Exp $"); __KERNEL_RCSID(0, "$NetBSD: osf1_exec_ecoff.c,v 1.21 2008/11/15 00:49:53 njoly Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -184,7 +184,6 @@ osf1_exec_ecoff_dynamic(struct lwp *l, struct exec_package *epp)
{ {
struct osf1_exec_emul_arg *emul_arg = epp->ep_emul_arg; struct osf1_exec_emul_arg *emul_arg = epp->ep_emul_arg;
struct ecoff_exechdr ldr_exechdr; struct ecoff_exechdr ldr_exechdr;
struct nameidata nd;
struct vnode *ldr_vp; struct vnode *ldr_vp;
size_t resid; size_t resid;
int error; int error;
@ -212,11 +211,9 @@ osf1_exec_ecoff_dynamic(struct lwp *l, struct exec_package *epp)
* make sure the object type is amenable, then arrange to * make sure the object type is amenable, then arrange to
* load it up. * load it up.
*/ */
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, UIO_SYSSPACE, ldr_vp = epp->ep_interp;
emul_arg->loader_name); epp->ep_interp = NULL;
if ((error = namei(&nd)) != 0) vn_lock(ldr_vp, LK_EXCLUSIVE | LK_RETRY);
goto bad_no_vp;
ldr_vp = nd.ni_vp;
/* /*
* Basic access checks. Reject if: * Basic access checks. Reject if:
@ -303,6 +300,5 @@ badunlock:
VOP_UNLOCK(ldr_vp, 0); VOP_UNLOCK(ldr_vp, 0);
bad: bad:
vrele(ldr_vp); vrele(ldr_vp);
bad_no_vp:
return (error); return (error);
} }