Add a new sysctl, kern.elf[32|64].can_exec_dyn. When set to 1, one can
execute a ET_DYN binary (shared object). This does not make much sense, but some linux scripts expect to be able to execute /lib/ld-linux.so.2 (ldd comes to mind). The sysctl defaults to 0. MFC after: 3 days
This commit is contained in:
parent
4c46ed51b6
commit
48c06903ba
@ -97,6 +97,11 @@ SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO,
|
||||
TUNABLE_INT("kern.elf" __XSTRING(__ELF_WORD_SIZE) ".fallback_brand",
|
||||
&__elfN(fallback_brand));
|
||||
|
||||
int __elfN(can_exec_dyn) = 0;
|
||||
SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO,
|
||||
can_exec_dyn, CTLFLAG_RW, &__elfN(can_exec_dyn), 0,
|
||||
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) " can exec shared libraries");
|
||||
|
||||
static int elf_trace = 0;
|
||||
SYSCTL_INT(_debug, OID_AUTO, __elfN(trace), CTLFLAG_RW, &elf_trace, 0, "");
|
||||
|
||||
@ -660,7 +665,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
/*
|
||||
* Do we have a valid ELF header ?
|
||||
*/
|
||||
if (__elfN(check_header)(hdr) != 0 || hdr->e_type != ET_EXEC)
|
||||
if (__elfN(check_header)(hdr) != 0 || (hdr->e_type != ET_EXEC
|
||||
&& (!__elfN(can_exec_dyn) || hdr->e_type != ET_DYN)))
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user