Follow kernel change, restore signal mask correctly by using a command
of kse_thr_interrupt.
This commit is contained in:
parent
84e0b075f6
commit
e897f51327
@ -39,30 +39,26 @@ __weak_reference(_execve, execve);
|
|||||||
int
|
int
|
||||||
_execve(const char *name, char *const *argv, char *const *envp)
|
_execve(const char *name, char *const *argv, char *const *envp)
|
||||||
{
|
{
|
||||||
sigset_t omask;
|
struct kse_execve_args args;
|
||||||
struct pthread *curthread;
|
struct pthread *curthread;
|
||||||
kse_critical_t crit;
|
|
||||||
int saved_errno;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
if (!_kse_isthreaded())
|
||||||
* When exec'ing, set the kernel signal mask to the thread's
|
ret = __sys_execve(name, argv, envp);
|
||||||
* signal mask to satisfy POSIX requirements. We have to enter
|
else {
|
||||||
* a critical region so that the kernel thread doesn't get
|
/*
|
||||||
* changed out from under us after setting the signal mask.
|
* When exec'ing, set the kernel signal mask to the thread's
|
||||||
*/
|
* signal mask to satisfy POSIX requirements.
|
||||||
curthread = _get_curthread();
|
*/
|
||||||
crit = _kse_critical_enter();
|
curthread = _get_curthread();
|
||||||
__sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, &omask);
|
args.sigmask = curthread->sigmask;
|
||||||
ret = __sys_execve(name, argv, envp);
|
args.sigpend = curthread->sigpend;
|
||||||
|
args.path = (char *)name;
|
||||||
|
args.argv = (char **)argv;
|
||||||
|
args.envp = (char **)envp;
|
||||||
|
args.reserved = NULL;
|
||||||
|
ret = kse_thr_interrupt(NULL, KSE_INTR_EXECVE, (long)&args);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If something went wrong, set the signal mask back but don't
|
|
||||||
* destroy errno.
|
|
||||||
*/
|
|
||||||
saved_errno = errno;
|
|
||||||
__sys_sigprocmask(SIG_SETMASK, &omask, NULL);
|
|
||||||
errno = saved_errno;
|
|
||||||
_kse_critical_leave(crit);
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
@ -39,30 +39,26 @@ __weak_reference(_execve, execve);
|
|||||||
int
|
int
|
||||||
_execve(const char *name, char *const *argv, char *const *envp)
|
_execve(const char *name, char *const *argv, char *const *envp)
|
||||||
{
|
{
|
||||||
sigset_t omask;
|
struct kse_execve_args args;
|
||||||
struct pthread *curthread;
|
struct pthread *curthread;
|
||||||
kse_critical_t crit;
|
|
||||||
int saved_errno;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
if (!_kse_isthreaded())
|
||||||
* When exec'ing, set the kernel signal mask to the thread's
|
ret = __sys_execve(name, argv, envp);
|
||||||
* signal mask to satisfy POSIX requirements. We have to enter
|
else {
|
||||||
* a critical region so that the kernel thread doesn't get
|
/*
|
||||||
* changed out from under us after setting the signal mask.
|
* When exec'ing, set the kernel signal mask to the thread's
|
||||||
*/
|
* signal mask to satisfy POSIX requirements.
|
||||||
curthread = _get_curthread();
|
*/
|
||||||
crit = _kse_critical_enter();
|
curthread = _get_curthread();
|
||||||
__sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, &omask);
|
args.sigmask = curthread->sigmask;
|
||||||
ret = __sys_execve(name, argv, envp);
|
args.sigpend = curthread->sigpend;
|
||||||
|
args.path = (char *)name;
|
||||||
|
args.argv = (char **)argv;
|
||||||
|
args.envp = (char **)envp;
|
||||||
|
args.reserved = NULL;
|
||||||
|
ret = kse_thr_interrupt(NULL, KSE_INTR_EXECVE, (long)&args);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If something went wrong, set the signal mask back but don't
|
|
||||||
* destroy errno.
|
|
||||||
*/
|
|
||||||
saved_errno = errno;
|
|
||||||
__sys_sigprocmask(SIG_SETMASK, &omask, NULL);
|
|
||||||
errno = saved_errno;
|
|
||||||
_kse_critical_leave(crit);
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user