Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exec.c
Show First 20 Lines • Show All 391 Lines • ▼ Show 20 Lines | #ifdef MAC | ||||
struct label *interpvplabel = NULL; | struct label *interpvplabel = NULL; | ||||
int will_transition; | int will_transition; | ||||
#endif | #endif | ||||
#ifdef HWPMC_HOOKS | #ifdef HWPMC_HOOKS | ||||
struct pmckern_procexec pe; | struct pmckern_procexec pe; | ||||
#endif | #endif | ||||
int error, i, orig_osrel; | int error, i, orig_osrel; | ||||
uint32_t orig_fctl0; | uint32_t orig_fctl0; | ||||
Elf_Brandinfo *orig_brandinfo; | |||||
static const char fexecv_proc_title[] = "(fexecv)"; | static const char fexecv_proc_title[] = "(fexecv)"; | ||||
imgp = &image_params; | imgp = &image_params; | ||||
#ifdef KTRACE | #ifdef KTRACE | ||||
kiop = NULL; | kiop = NULL; | ||||
#endif | #endif | ||||
/* | /* | ||||
Show All 14 Lines | #endif | ||||
*/ | */ | ||||
bzero(imgp, sizeof(*imgp)); | bzero(imgp, sizeof(*imgp)); | ||||
imgp->proc = p; | imgp->proc = p; | ||||
imgp->attr = &attr; | imgp->attr = &attr; | ||||
imgp->args = args; | imgp->args = args; | ||||
oldcred = p->p_ucred; | oldcred = p->p_ucred; | ||||
orig_osrel = p->p_osrel; | orig_osrel = p->p_osrel; | ||||
orig_fctl0 = p->p_fctl0; | orig_fctl0 = p->p_fctl0; | ||||
orig_brandinfo = p->p_elf_brandinfo; | |||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_execve_enter(imgp, mac_p); | error = mac_execve_enter(imgp, mac_p); | ||||
if (error) | if (error) | ||||
goto exec_fail; | goto exec_fail; | ||||
#endif | #endif | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if (imgp->object != NULL) | ||||
vm_object_reference(imgp->object); | vm_object_reference(imgp->object); | ||||
error = exec_map_first_page(imgp); | error = exec_map_first_page(imgp); | ||||
if (error) | if (error) | ||||
goto exec_fail_dealloc; | goto exec_fail_dealloc; | ||||
imgp->proc->p_osrel = 0; | imgp->proc->p_osrel = 0; | ||||
imgp->proc->p_fctl0 = 0; | imgp->proc->p_fctl0 = 0; | ||||
imgp->proc->p_elf_brandinfo = NULL; | |||||
/* | /* | ||||
* Implement image setuid/setgid. | * Implement image setuid/setgid. | ||||
* | * | ||||
* Determine new credentials before attempting image activators | * Determine new credentials before attempting image activators | ||||
* so that it can be used by process_exec handlers to determine | * so that it can be used by process_exec handlers to determine | ||||
* credential/setid changes. | * credential/setid changes. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 379 Lines • ▼ Show 20 Lines | #endif | ||||
VOP_MMAPPED(imgp->vp); | VOP_MMAPPED(imgp->vp); | ||||
SDT_PROBE1(proc, , , exec__success, args->fname); | SDT_PROBE1(proc, , , exec__success, args->fname); | ||||
exec_fail_dealloc: | exec_fail_dealloc: | ||||
if (error != 0) { | if (error != 0) { | ||||
p->p_osrel = orig_osrel; | p->p_osrel = orig_osrel; | ||||
p->p_fctl0 = orig_fctl0; | p->p_fctl0 = orig_fctl0; | ||||
p->p_elf_brandinfo = orig_brandinfo; | |||||
} | } | ||||
if (imgp->firstpage != NULL) | if (imgp->firstpage != NULL) | ||||
exec_unmap_first_page(imgp); | exec_unmap_first_page(imgp); | ||||
if (imgp->vp != NULL) { | if (imgp->vp != NULL) { | ||||
if (args->fname) | if (args->fname) | ||||
NDFREE(&nd, NDF_ONLY_PNBUF); | NDFREE(&nd, NDF_ONLY_PNBUF); | ||||
▲ Show 20 Lines • Show All 1,119 Lines • Show Last 20 Lines |