diff options
| author | matt <matt@NetBSD.org> | 2013-09-10 21:30:21 +0000 |
|---|---|---|
| committer | matt <matt@NetBSD.org> | 2013-09-10 21:30:21 +0000 |
| commit | 95db636eb83feec50c8116137d5fdc3bc7febc73 (patch) | |
| tree | dcda7d1ed65a08bba96a7553b3039fc07ba1a533 /sys/kern/exec_elf.c | |
| parent | 977f1c0d1ad8616d23ce128a9ce0192263bac03c (diff) | |
Support an optional MARCH ELF tag.
Store the MACHINE_ARCH of the executable in mdproc and override sysctl
so that value returned.
Diffstat (limited to 'sys/kern/exec_elf.c')
| -rw-r--r-- | sys/kern/exec_elf.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index 63b6c0b6ea2..68385101059 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $NetBSD: exec_elf.c,v 1.46 2013/08/26 12:24:10 martin Exp $ */ +/* $NetBSD: exec_elf.c,v 1.47 2013/09/10 21:30:21 matt 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.46 2013/08/26 12:24:10 martin Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.47 2013/09/10 21:30:21 matt Exp $"); #ifdef _KERNEL_OPT #include "opt_pax.h" @@ -946,6 +946,24 @@ bad: sizeof(epp->ep_pax_flags)); break; + case ELF_NOTE_TYPE_MARCH_TAG: + /* + * Copy the machine arch into the package. + */ + if (np->n_namesz == ELF_NOTE_MARCH_NAMESZ + && memcmp(ndata, ELF_NOTE_MARCH_NAME, + ELF_NOTE_MARCH_NAMESZ) == 0) { + strlcpy(epp->ep_machine_arch, + ndata + roundup(ELF_NOTE_MARCH_NAMESZ, 4), + sizeof(epp->ep_machine_arch)); + break; + } + + /* + * Dunno, warn for diagnostic + */ + goto bad; + case ELF_NOTE_TYPE_SUSE_VERSION_TAG: break; |
