if the interpreter is literally "/usr/libexec/ld.elf_so" or
"/libexec/ld.elf_so", try <path>-<machine32arch>.
This commit is contained in:
parent
3912b43d37
commit
27498ba7bc
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netbsd32_exec_elf32.c,v 1.28 2008/05/29 14:51:26 mrg Exp $ */
|
||||
/* $NetBSD: netbsd32_exec_elf32.c,v 1.29 2008/10/26 07:07:35 mrg Exp $ */
|
||||
/* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */
|
||||
|
||||
/*
|
||||
@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_exec_elf32.c,v 1.28 2008/05/29 14:51:26 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_exec_elf32.c,v 1.29 2008/10/26 07:07:35 mrg Exp $");
|
||||
|
||||
#define ELFSIZE 32
|
||||
|
||||
@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_exec_elf32.c,v 1.28 2008/05/29 14:51:26 mrg
|
||||
#include <sys/signal.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/namei.h>
|
||||
|
||||
#include <compat/netbsd32/netbsd32.h>
|
||||
#include <compat/netbsd32/netbsd32_exec.h>
|
||||
@ -105,8 +106,39 @@ ELFNAME2(netbsd32,probe_noteless)(struct lwp *l, struct exec_package *epp,
|
||||
int error;
|
||||
|
||||
if (itp) {
|
||||
/*
|
||||
* If the path is exactly "/usr/libexec/ld.elf_so", first
|
||||
* try to see if "/usr/libexec/ld.elf_so-<arch>" exists
|
||||
* and if so, use that instead.
|
||||
* XXX maybe move this into compat/common
|
||||
*/
|
||||
error = 0;
|
||||
if (strcmp(itp, "/usr/libexec/ld.elf_so") == 0 ||
|
||||
strcmp(itp, "/libexec/ld.elf_so") == 0) {
|
||||
extern const char machine32[];
|
||||
struct nameidata nd;
|
||||
char *path;
|
||||
|
||||
if (epp->ep_interp != NULL)
|
||||
vrele(epp->ep_interp);
|
||||
|
||||
path = PNBUF_GET();
|
||||
snprintf(path, MAXPATHLEN, "%s-%s", itp, machine32);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path);
|
||||
error = namei(&nd);
|
||||
/*
|
||||
* If that worked, save interpreter in case we
|
||||
* actually need to load it
|
||||
*/
|
||||
if (error != 0)
|
||||
epp->ep_interp = NULL;
|
||||
else
|
||||
epp->ep_interp = nd.ni_vp;
|
||||
PNBUF_PUT(path);
|
||||
}
|
||||
|
||||
/* Translate interpreter name if needed */
|
||||
if ((error = emul_find_interp(l, epp, itp)) != 0)
|
||||
if (error && (error = emul_find_interp(l, epp, itp)) != 0)
|
||||
return error;
|
||||
}
|
||||
epp->ep_flags |= EXEC_32;
|
||||
|
Loading…
x
Reference in New Issue
Block a user