Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exec.c
Show First 20 Lines • Show All 498 Lines • ▼ Show 20 Lines | if (args->fname[0] == '/') { | ||||
VOP_UNLOCK(imgp->vp); | VOP_UNLOCK(imgp->vp); | ||||
freepath_size = MAXPATHLEN; | freepath_size = MAXPATHLEN; | ||||
if (vn_fullpath_hardlink(newtextvp, newtextdvp, | if (vn_fullpath_hardlink(newtextvp, newtextdvp, | ||||
newbinname, nd.ni_cnd.cn_namelen, &imgp->execpath, | newbinname, nd.ni_cnd.cn_namelen, &imgp->execpath, | ||||
&imgp->freepath, &freepath_size) != 0) | &imgp->freepath, &freepath_size) != 0) | ||||
imgp->execpath = args->fname; | imgp->execpath = args->fname; | ||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY); | vn_lock(imgp->vp, LK_SHARED | LK_RETRY); | ||||
} | } | ||||
} else if (imgp->interpreter_vp) { | |||||
/* | |||||
* An image activator has already provided an open vnode | |||||
*/ | |||||
newtextvp = imgp->interpreter_vp; | |||||
imgp->interpreter_vp = NULL; | |||||
if (vn_fullpath(newtextvp, &imgp->execpath, | |||||
&imgp->freepath) != 0) | |||||
imgp->execpath = args->fname; | |||||
vn_lock(newtextvp, LK_SHARED | LK_RETRY); | |||||
AUDIT_ARG_VNODE1(newtextvp); | |||||
imgp->vp = newtextvp; | |||||
} else { | } else { | ||||
AUDIT_ARG_FD(args->fd); | AUDIT_ARG_FD(args->fd); | ||||
/* | /* | ||||
* If the descriptors was not opened with O_PATH, then | * If the descriptors was not opened with O_PATH, then | ||||
* we require that it was opened with O_EXEC or | * we require that it was opened with O_EXEC or | ||||
* O_RDONLY. In either case, exec_check_permissions() | * O_RDONLY. In either case, exec_check_permissions() | ||||
* below checks _current_ file access mode regardless | * below checks _current_ file access mode regardless | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
vm_object_deallocate(imgp->object); | vm_object_deallocate(imgp->object); | ||||
imgp->object = NULL; | imgp->object = NULL; | ||||
execve_nosetid(imgp); | execve_nosetid(imgp); | ||||
imgp->execpath = NULL; | imgp->execpath = NULL; | ||||
free(imgp->freepath, M_TEMP); | free(imgp->freepath, M_TEMP); | ||||
imgp->freepath = NULL; | imgp->freepath = NULL; | ||||
/* set new name to that of the interpreter */ | /* set new name to that of the interpreter */ | ||||
if (imgp->interpreter_vp) { | |||||
args->fname = NULL; | |||||
} else { | |||||
args->fname = imgp->interpreter_name; | args->fname = imgp->interpreter_name; | ||||
} | |||||
goto interpret; | goto interpret; | ||||
} | } | ||||
/* | /* | ||||
* NB: We unlock the vnode here because it is believed that none | * NB: We unlock the vnode here because it is believed that none | ||||
* of the sv_copyout_strings/sv_fixup operations require the vnode. | * of the sv_copyout_strings/sv_fixup operations require the vnode. | ||||
*/ | */ | ||||
VOP_UNLOCK(imgp->vp); | VOP_UNLOCK(imgp->vp); | ||||
▲ Show 20 Lines • Show All 1,373 Lines • Show Last 20 Lines |