Changeset View
Changeset View
Standalone View
Standalone View
head/sys/powerpc/powerpc/elf_common.c
Show All 30 Lines | |||||
static int | static int | ||||
__elfN(powerpc_copyout_auxargs)(struct image_params *imgp, uintptr_t base) | __elfN(powerpc_copyout_auxargs)(struct image_params *imgp, uintptr_t base) | ||||
{ | { | ||||
Elf_Auxargs *args; | Elf_Auxargs *args; | ||||
Elf_Auxinfo *argarray, *pos; | Elf_Auxinfo *argarray, *pos; | ||||
int error; | int error; | ||||
if (imgp->proc->p_osrel >= P_OSREL_POWERPC_NEW_AUX_ARGS) | /* | ||||
* XXX If we can't find image's OSREL, assume it uses the new auxv | |||||
* format. | |||||
* | |||||
* This is specially important for rtld, that is not tagged. Using | |||||
* direct exec mode with new (ELFv2) binaries that expect the new auxv | |||||
* format would result in crashes otherwise. | |||||
* | |||||
* Unfortunately, this may break direct exec'ing old binaries, | |||||
* but it seems better to correctly support new binaries by default, | |||||
* considering the transition to ELFv2 happened quite some time | |||||
* ago. If needed, a sysctl may be added to allow old auxv format to | |||||
* be used when OSREL is not found. | |||||
*/ | |||||
if (imgp->proc->p_osrel >= P_OSREL_POWERPC_NEW_AUX_ARGS || | |||||
imgp->proc->p_osrel == 0) | |||||
return (__elfN(freebsd_copyout_auxargs)(imgp, base)); | return (__elfN(freebsd_copyout_auxargs)(imgp, base)); | ||||
args = (Elf_Auxargs *)imgp->auxargs; | args = (Elf_Auxargs *)imgp->auxargs; | ||||
argarray = pos = malloc(AT_OLD_COUNT * sizeof(*pos), M_TEMP, | argarray = pos = malloc(AT_OLD_COUNT * sizeof(*pos), M_TEMP, | ||||
M_WAITOK | M_ZERO); | M_WAITOK | M_ZERO); | ||||
if (args->execfd != -1) | if (args->execfd != -1) | ||||
AUXARGS_ENTRY(pos, AT_OLD_EXECFD, args->execfd); | AUXARGS_ENTRY(pos, AT_OLD_EXECFD, args->execfd); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |