Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/imgact_elf.c
Show First 20 Lines • Show All 1,163 Lines • ▼ Show 20 Lines | __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) | ||||
brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel, &fctl0); | brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel, &fctl0); | ||||
if (brand_info == NULL) { | if (brand_info == NULL) { | ||||
uprintf("ELF binary type \"%u\" not known.\n", | uprintf("ELF binary type \"%u\" not known.\n", | ||||
hdr->e_ident[EI_OSABI]); | hdr->e_ident[EI_OSABI]); | ||||
error = ENOEXEC; | error = ENOEXEC; | ||||
goto ret; | goto ret; | ||||
} | } | ||||
sv = brand_info->sysvec; | sv = brand_info->sysvec; | ||||
et_dyn_addr = 0; | et_dyn_addr = 0; | ||||
kib: How could this work? Imagine you have two brands pointing to the same sysent. Then the latest… | |||||
Not Done Inline Actions
whoops, indeed. thanks. ugh, i need a knowledge about which is brand is in use, but the second way that i see is not good. dchagin: > How could this work? Imagine you have two brands pointing to the same sysent. Then the… | |||||
Not Done Inline ActionsStore the brand in struct proc? kib: Store the brand in struct proc? | |||||
if (hdr->e_type == ET_DYN) { | if (hdr->e_type == ET_DYN) { | ||||
if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) { | if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) { | ||||
uprintf("Cannot execute shared object\n"); | uprintf("Cannot execute shared object\n"); | ||||
error = ENOEXEC; | error = ENOEXEC; | ||||
goto ret; | goto ret; | ||||
} | } | ||||
/* | /* | ||||
* Honour the base load address from the dso if it is | * Honour the base load address from the dso if it is | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) | ||||
if (!__elfN(allow_wx) && (fctl0 & NT_FREEBSD_FCTL_WXNEEDED) == 0) | if (!__elfN(allow_wx) && (fctl0 & NT_FREEBSD_FCTL_WXNEEDED) == 0) | ||||
imgp->map_flags |= MAP_WXORX; | imgp->map_flags |= MAP_WXORX; | ||||
error = exec_new_vmspace(imgp, sv); | error = exec_new_vmspace(imgp, sv); | ||||
vmspace = imgp->proc->p_vmspace; | vmspace = imgp->proc->p_vmspace; | ||||
map = &vmspace->vm_map; | map = &vmspace->vm_map; | ||||
imgp->proc->p_sysent = sv; | imgp->proc->p_sysent = sv; | ||||
imgp->proc->p_elf_brandinfo = brand_info; | |||||
maxv = vm_map_max(map) - lim_max(td, RLIMIT_STACK); | maxv = vm_map_max(map) - lim_max(td, RLIMIT_STACK); | ||||
if (et_dyn_addr == ET_DYN_ADDR_RAND) { | if (et_dyn_addr == ET_DYN_ADDR_RAND) { | ||||
KASSERT((map->flags & MAP_ASLR) != 0, | KASSERT((map->flags & MAP_ASLR) != 0, | ||||
("ET_DYN_ADDR_RAND but !MAP_ASLR")); | ("ET_DYN_ADDR_RAND but !MAP_ASLR")); | ||||
et_dyn_addr = __CONCAT(rnd_, __elfN(base))(map, | et_dyn_addr = __CONCAT(rnd_, __elfN(base))(map, | ||||
vm_map_min(map) + mapsz + lim_max(td, RLIMIT_DATA), | vm_map_min(map) + mapsz + lim_max(td, RLIMIT_DATA), | ||||
/* reserve half of the address space to interpreter */ | /* reserve half of the address space to interpreter */ | ||||
▲ Show 20 Lines • Show All 1,441 Lines • Show Last 20 Lines |
How could this work? Imagine you have two brands pointing to the same sysent. Then the latest executed brand would always override brand_info in sysvec.