mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-22 01:34:09 +00:00
- Provide backwards compatibility for kern.fallback_elf_brand.
- Use the generic elf type macros in imgact_elf.h instead of ifdefing the entire contents of the header.
This commit is contained in:
parent
051900864f
commit
e548a1d4c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108696
|
@ -67,9 +67,6 @@
|
|||
|
||||
#define OLD_EI_BRAND 8
|
||||
|
||||
__ElfType(Brandinfo);
|
||||
__ElfType(Auxargs);
|
||||
|
||||
static int __elfN(check_header)(const Elf_Ehdr *hdr);
|
||||
static Elf_Brandinfo *__elfN(get_brandinfo)(const Elf_Ehdr *hdr,
|
||||
const char *interp);
|
||||
|
@ -84,12 +81,12 @@ static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
|
|||
SYSCTL_NODE(_kern, OID_AUTO, __CONCAT(elf, __ELF_WORD_SIZE), CTLFLAG_RW, 0,
|
||||
"");
|
||||
|
||||
static int fallback_brand = -1;
|
||||
SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, fallback_brand,
|
||||
CTLFLAG_RW, &fallback_brand, 0,
|
||||
int __elfN(fallback_brand) = -1;
|
||||
SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO,
|
||||
fallback_brand, CTLFLAG_RW, &__elfN(fallback_brand), 0,
|
||||
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) " brand of last resort");
|
||||
TUNABLE_INT("kern.elf" __XSTRING(__ELF_WORD_SIZE) ".fallback_brand",
|
||||
&fallback_brand);
|
||||
&__elfN(fallback_brand));
|
||||
|
||||
static int elf_trace = 0;
|
||||
SYSCTL_INT(_debug, OID_AUTO, __elfN(trace), CTLFLAG_RW, &elf_trace, 0, "");
|
||||
|
@ -188,7 +185,7 @@ __elfN(get_brandinfo)(const Elf_Ehdr *hdr, const char *interp)
|
|||
for (i = 0; i < MAX_BRANDS; i++) {
|
||||
bi = elf_brand_list[i];
|
||||
if (bi != NULL && hdr->e_machine == bi->machine &&
|
||||
fallback_brand == bi->brand)
|
||||
__elfN(fallback_brand) == bi->brand)
|
||||
return (bi);
|
||||
}
|
||||
return (NULL);
|
||||
|
|
|
@ -362,6 +362,9 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD,
|
|||
SYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD,
|
||||
0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)");
|
||||
|
||||
SYSCTL_STRING(_kern, OID_AUTO, fallback_elf_brand, CTLFLAG_RD,
|
||||
"kern.fallback_elf_brand is deprecated, use kern.elf32.fallback_brand or "
|
||||
"kern.elf64.fallback_brand" , 0, "");
|
||||
/* XXX compatibility, remove for 6.0 */
|
||||
#include <sys/imgact.h>
|
||||
#include <sys/imgact_elf.h>
|
||||
SYSCTL_INT(_kern, OID_AUTO, fallback_elf_brand, CTLFLAG_RW,
|
||||
&__elfN(fallback_brand), sizeof(__elfN(fallback_brand)),
|
||||
"compatibility for kern.fallback_elf_brand");
|
||||
|
|
|
@ -39,23 +39,21 @@
|
|||
|
||||
struct thread;
|
||||
|
||||
#if ELF_TARG_CLASS == ELFCLASS32
|
||||
|
||||
/*
|
||||
* Structure used to pass infomation from the loader to the
|
||||
* stack fixup routine.
|
||||
*/
|
||||
typedef struct {
|
||||
Elf32_Sword execfd;
|
||||
Elf32_Word phdr;
|
||||
Elf32_Word phent;
|
||||
Elf32_Word phnum;
|
||||
Elf32_Word pagesz;
|
||||
Elf32_Word base;
|
||||
Elf32_Word flags;
|
||||
Elf32_Word entry;
|
||||
Elf32_Word trace;
|
||||
} Elf32_Auxargs;
|
||||
Elf_Sword execfd;
|
||||
Elf_Word phdr;
|
||||
Elf_Word phent;
|
||||
Elf_Word phnum;
|
||||
Elf_Word pagesz;
|
||||
Elf_Word base;
|
||||
Elf_Word flags;
|
||||
Elf_Word entry;
|
||||
Elf_Word trace;
|
||||
} __ElfN(Auxargs);
|
||||
|
||||
typedef struct {
|
||||
int brand;
|
||||
|
@ -64,52 +62,20 @@ typedef struct {
|
|||
const char *emul_path;
|
||||
const char *interp_path;
|
||||
struct sysentvec *sysvec;
|
||||
} Elf32_Brandinfo;
|
||||
} __ElfN(Brandinfo);
|
||||
|
||||
__ElfType(Auxargs);
|
||||
__ElfType(Brandinfo);
|
||||
|
||||
#define MAX_BRANDS 8
|
||||
|
||||
int elf32_brand_inuse(Elf32_Brandinfo *entry);
|
||||
int elf32_insert_brand_entry(Elf32_Brandinfo *entry);
|
||||
int elf32_remove_brand_entry(Elf32_Brandinfo *entry);
|
||||
int elf32_freebsd_fixup(register_t **, struct image_params *);
|
||||
int elf32_coredump(struct thread *, struct vnode *, off_t);
|
||||
int __elfN(brand_inuse)(Elf_Brandinfo *entry);
|
||||
int __elfN(insert_brand_entry)(Elf_Brandinfo *entry);
|
||||
int __elfN(remove_brand_entry)(Elf_Brandinfo *entry);
|
||||
int __elfN(freebsd_fixup)(register_t **, struct image_params *);
|
||||
int __elfN(coredump)(struct thread *, struct vnode *, off_t);
|
||||
|
||||
#else /* !(ELF_TARG_CLASS == ELFCLASS32) */
|
||||
|
||||
/*
|
||||
* Structure used to pass infomation from the loader to the
|
||||
* stack fixup routine.
|
||||
*/
|
||||
typedef struct {
|
||||
Elf64_Sword execfd;
|
||||
Elf64_Addr phdr;
|
||||
Elf64_Word phent;
|
||||
Elf64_Word phnum;
|
||||
Elf64_Word pagesz;
|
||||
Elf64_Addr base;
|
||||
Elf64_Word flags;
|
||||
Elf64_Addr entry;
|
||||
Elf64_Word trace;
|
||||
} Elf64_Auxargs;
|
||||
|
||||
typedef struct {
|
||||
int brand;
|
||||
int machine;
|
||||
const char *compat_3_brand; /* pre Binutils 2.10 method (FBSD 3) */
|
||||
const char *emul_path;
|
||||
const char *interp_path;
|
||||
struct sysentvec *sysvec;
|
||||
} Elf64_Brandinfo;
|
||||
|
||||
#define MAX_BRANDS 8
|
||||
|
||||
int elf64_brand_inuse(Elf64_Brandinfo *entry);
|
||||
int elf64_insert_brand_entry(Elf64_Brandinfo *entry);
|
||||
int elf64_remove_brand_entry(Elf64_Brandinfo *entry);
|
||||
int elf64_freebsd_fixup(register_t **, struct image_params *);
|
||||
int elf64_coredump(struct thread *, struct vnode *, off_t);
|
||||
|
||||
#endif /* ELF_TARG_CLASS == ELFCLASS32 */
|
||||
extern int __elfN(fallback_brand);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
|
Loading…
Reference in a new issue