Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/imgact_elf.c
Show First 20 Lines • Show All 1,281 Lines • ▼ Show 20 Lines | __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) | ||||
* its maximum allowed size. | * its maximum allowed size. | ||||
*/ | */ | ||||
addr = round_page((vm_offset_t)vmspace->vm_daddr + lim_max(td, | addr = round_page((vm_offset_t)vmspace->vm_daddr + lim_max(td, | ||||
RLIMIT_DATA)); | RLIMIT_DATA)); | ||||
if ((map->flags & MAP_ASLR) != 0) { | if ((map->flags & MAP_ASLR) != 0) { | ||||
maxv1 = maxv / 2 + addr / 2; | maxv1 = maxv / 2 + addr / 2; | ||||
MPASS(maxv1 >= addr); /* No overflow */ | MPASS(maxv1 >= addr); /* No overflow */ | ||||
map->anon_loc = __CONCAT(rnd_, __elfN(base))(map, addr, maxv1, | map->anon_loc = __CONCAT(rnd_, __elfN(base))(map, addr, maxv1, | ||||
MAXPAGESIZES > 1 ? pagesizes[1] : pagesizes[0]); | (MAXPAGESIZES > 1 && pagesizes[1] != 0) ? | ||||
pagesizes[1] : pagesizes[0]); | |||||
} else { | } else { | ||||
map->anon_loc = addr; | map->anon_loc = addr; | ||||
} | } | ||||
imgp->entry_addr = entry; | imgp->entry_addr = entry; | ||||
if (interp != NULL) { | if (interp != NULL) { | ||||
VOP_UNLOCK(imgp->vp); | VOP_UNLOCK(imgp->vp); | ||||
if ((map->flags & MAP_ASLR) != 0) { | if ((map->flags & MAP_ASLR) != 0) { | ||||
/* Assume that interpeter fits into 1/4 of AS */ | /* Assume that interpreter fits into 1/4 of AS */ | ||||
maxv1 = maxv / 2 + addr / 2; | maxv1 = maxv / 2 + addr / 2; | ||||
MPASS(maxv1 >= addr); /* No overflow */ | MPASS(maxv1 >= addr); /* No overflow */ | ||||
addr = __CONCAT(rnd_, __elfN(base))(map, addr, | addr = __CONCAT(rnd_, __elfN(base))(map, addr, | ||||
maxv1, PAGE_SIZE); | maxv1, PAGE_SIZE); | ||||
} | } | ||||
error = __elfN(load_interp)(imgp, brand_info, interp, &addr, | error = __elfN(load_interp)(imgp, brand_info, interp, &addr, | ||||
&imgp->entry_addr); | &imgp->entry_addr); | ||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY); | vn_lock(imgp->vp, LK_SHARED | LK_RETRY); | ||||
▲ Show 20 Lines • Show All 1,533 Lines • Show Last 20 Lines |