Use get_mcontext in sendsig and set_mcontext in sigreturn instead of
frobbing things directly.
This commit is contained in:
parent
fc3e87b367
commit
2974095528
@ -433,11 +433,11 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
|
|||||||
|
|
||||||
/* Save user context. */
|
/* Save user context. */
|
||||||
bzero(&sf, sizeof(sf));
|
bzero(&sf, sizeof(sf));
|
||||||
|
get_mcontext(td, &sf.sf_uc.uc_mcontext, 0);
|
||||||
sf.sf_uc.uc_sigmask = *mask;
|
sf.sf_uc.uc_sigmask = *mask;
|
||||||
sf.sf_uc.uc_stack = p->p_sigstk;
|
sf.sf_uc.uc_stack = p->p_sigstk;
|
||||||
sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
|
sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
|
||||||
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
|
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
|
||||||
bcopy(tf, &sf.sf_uc.uc_mcontext, sizeof(*tf));
|
|
||||||
|
|
||||||
/* Allocate and validate space for the signal handler context. */
|
/* Allocate and validate space for the signal handler context. */
|
||||||
if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
|
if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
|
||||||
@ -520,10 +520,9 @@ struct sigreturn_args {
|
|||||||
int
|
int
|
||||||
sigreturn(struct thread *td, struct sigreturn_args *uap)
|
sigreturn(struct thread *td, struct sigreturn_args *uap)
|
||||||
{
|
{
|
||||||
struct trapframe *tf;
|
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
mcontext_t *mc;
|
|
||||||
ucontext_t uc;
|
ucontext_t uc;
|
||||||
|
int error;
|
||||||
|
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
if (rwindow_save(td)) {
|
if (rwindow_save(td)) {
|
||||||
@ -537,12 +536,9 @@ sigreturn(struct thread *td, struct sigreturn_args *uap)
|
|||||||
return (EFAULT);
|
return (EFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
mc = &uc.uc_mcontext;
|
error = set_mcontext(td, &uc.uc_mcontext);
|
||||||
tf = td->td_frame;
|
if (error != 0)
|
||||||
if (!TSTATE_SECURE(mc->mc_tstate))
|
return (error);
|
||||||
return (EINVAL);
|
|
||||||
mc->mc_wstate = tf->tf_wstate;
|
|
||||||
bcopy(mc, tf, sizeof(*tf));
|
|
||||||
|
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
td->td_sigmask = uc.uc_sigmask;
|
td->td_sigmask = uc.uc_sigmask;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user