Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/linux32/linux32_sysvec.c
Show First 20 Lines • Show All 765 Lines • ▼ Show 20 Lines | linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) | ||||
int argc, envc, error; | int argc, envc, error; | ||||
u_int32_t *vectp; | u_int32_t *vectp; | ||||
char *stringp; | char *stringp; | ||||
uintptr_t destp, ustringp; | uintptr_t destp, ustringp; | ||||
struct linux32_ps_strings *arginfo; | struct linux32_ps_strings *arginfo; | ||||
char canary[LINUX_AT_RANDOM_LEN]; | char canary[LINUX_AT_RANDOM_LEN]; | ||||
size_t execpath_len; | size_t execpath_len; | ||||
/* Calculate string base and vector table pointers. */ | |||||
if (imgp->execpath != NULL && imgp->auxargs != NULL) | |||||
execpath_len = strlen(imgp->execpath) + 1; | |||||
else | |||||
execpath_len = 0; | |||||
arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; | arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; | ||||
destp = (uintptr_t)arginfo; | destp = (uintptr_t)arginfo; | ||||
if (execpath_len != 0) { | if (imgp->execpath != NULL && imgp->auxargs != NULL) { | ||||
execpath_len = strlen(imgp->execpath) + 1; | |||||
destp -= execpath_len; | destp -= execpath_len; | ||||
destp = rounddown2(destp, sizeof(uint32_t)); | destp = rounddown2(destp, sizeof(uint32_t)); | ||||
imgp->execpathp = (void *)destp; | imgp->execpathp = (void *)destp; | ||||
error = copyout(imgp->execpath, imgp->execpathp, execpath_len); | error = copyout(imgp->execpath, imgp->execpathp, execpath_len); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 441 Lines • Show Last 20 Lines |