Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/imgact_elf.c
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | #if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 bit */ || \ | ||||
1; | 1; | ||||
#else | #else | ||||
0; | 0; | ||||
#endif | #endif | ||||
SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, | SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, | ||||
nxstack, CTLFLAG_RW, &__elfN(nxstack), 0, | nxstack, CTLFLAG_RW, &__elfN(nxstack), 0, | ||||
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack"); | __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack"); | ||||
#if defined(__amd64__) | |||||
static int __elfN(vdso) = 1; | |||||
emaste: Any reason not to make this 1 everywhere (in the near future)? | |||||
Done Inline ActionsI definitely do not have plans to work on it. It is up to the arch maintainer to do the necessary copy/paste and testing. In principle, I will prepare the arch patch if somebody going to test that. kib: I definitely do not have plans to work on it. It is up to the arch maintainer to do the… | |||||
Done Inline ActionsI just mean that for the kernel to provide AT_KPRELOAD __elfN(vdso) must be nonzero and sv_vdso_base must also be nonzero so there's no problem setting it to 1. I suppose there is some documentary value in having it report 0 to the user if not supported by the arch. emaste: I just mean that for the kernel to provide `AT_KPRELOAD` `__elfN(vdso)` must be nonzero and… | |||||
Done Inline ActionsMight be, it is useful to hide the sysctl at all from not supported arches. I will do this. kib: Might be, it is useful to hide the sysctl at all from not supported arches. I will do this. | |||||
Done Inline ActionsOK, I think that is better. emaste: OK, I think that is better. | |||||
SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, | |||||
vdso, CTLFLAG_RWTUN, &__elfN(vdso), 0, | |||||
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable vdso preloading"); | |||||
#else | |||||
static int __elfN(vdso) = 0; | |||||
#endif | |||||
#if __ELF_WORD_SIZE == 32 && (defined(__amd64__) || defined(__i386__)) | #if __ELF_WORD_SIZE == 32 && (defined(__amd64__) || defined(__i386__)) | ||||
int i386_read_exec = 0; | int i386_read_exec = 0; | ||||
SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0, | SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0, | ||||
"enable execution from readable segments"); | "enable execution from readable segments"); | ||||
#endif | #endif | ||||
static u_long __elfN(pie_base) = ET_DYN_LOAD_ADDR; | static u_long __elfN(pie_base) = ET_DYN_LOAD_ADDR; | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 1,269 Lines • ▼ Show 20 Lines | AUXARGS_ENTRY(pos, AT_BSDFLAGS, __elfN(sigfastblock) ? | ||||
ELF_BSDF_SIGFASTBLK : 0); | ELF_BSDF_SIGFASTBLK : 0); | ||||
AUXARGS_ENTRY(pos, AT_ARGC, imgp->args->argc); | AUXARGS_ENTRY(pos, AT_ARGC, imgp->args->argc); | ||||
AUXARGS_ENTRY_PTR(pos, AT_ARGV, imgp->argv); | AUXARGS_ENTRY_PTR(pos, AT_ARGV, imgp->argv); | ||||
AUXARGS_ENTRY(pos, AT_ENVC, imgp->args->envc); | AUXARGS_ENTRY(pos, AT_ENVC, imgp->args->envc); | ||||
AUXARGS_ENTRY_PTR(pos, AT_ENVV, imgp->envv); | AUXARGS_ENTRY_PTR(pos, AT_ENVV, imgp->envv); | ||||
AUXARGS_ENTRY_PTR(pos, AT_PS_STRINGS, imgp->ps_strings); | AUXARGS_ENTRY_PTR(pos, AT_PS_STRINGS, imgp->ps_strings); | ||||
if (imgp->sysent->sv_fxrng_gen_base != 0) | if (imgp->sysent->sv_fxrng_gen_base != 0) | ||||
AUXARGS_ENTRY(pos, AT_FXRNG, imgp->sysent->sv_fxrng_gen_base); | AUXARGS_ENTRY(pos, AT_FXRNG, imgp->sysent->sv_fxrng_gen_base); | ||||
if (imgp->sysent->sv_vdso_base != 0 && __elfN(vdso) != 0) | |||||
AUXARGS_ENTRY(pos, AT_KPRELOAD, imgp->sysent->sv_vdso_base); | |||||
AUXARGS_ENTRY(pos, AT_NULL, 0); | AUXARGS_ENTRY(pos, AT_NULL, 0); | ||||
free(imgp->auxargs, M_TEMP); | free(imgp->auxargs, M_TEMP); | ||||
imgp->auxargs = NULL; | imgp->auxargs = NULL; | ||||
KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); | KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); | ||||
error = copyout(argarray, (void *)base, sizeof(*argarray) * AT_COUNT); | error = copyout(argarray, (void *)base, sizeof(*argarray) * AT_COUNT); | ||||
free(argarray, M_TEMP); | free(argarray, M_TEMP); | ||||
▲ Show 20 Lines • Show All 1,294 Lines • Show Last 20 Lines |
Any reason not to make this 1 everywhere (in the near future)?