Protect td_sigmask with the proc lock.

This commit is contained in:
jhb 2003-04-17 22:21:57 +00:00
parent c2f9daed4a
commit b47a58c180
4 changed files with 11 additions and 1 deletions

View File

@ -66,13 +66,15 @@ int
getcontext(struct thread *td, struct getcontext_args *uap) getcontext(struct thread *td, struct getcontext_args *uap)
{ {
ucontext_t uc; ucontext_t uc;
int ret; int ret;
if (uap->ucp == NULL) if (uap->ucp == NULL)
ret = EINVAL; ret = EINVAL;
else { else {
get_mcontext(td, &uc.uc_mcontext); get_mcontext(td, &uc.uc_mcontext);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask; uc.uc_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
ret = copyout(&uc, uap->ucp, UC_COPY_SIZE); ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
} }
return (ret); return (ret);
@ -114,7 +116,9 @@ swapcontext(struct thread *td, struct swapcontext_args *uap)
ret = EINVAL; ret = EINVAL;
else { else {
get_mcontext(td, &uc.uc_mcontext); get_mcontext(td, &uc.uc_mcontext);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask; uc.uc_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
ret = copyout(&uc, uap->oucp, UC_COPY_SIZE); ret = copyout(&uc, uap->oucp, UC_COPY_SIZE);
if (ret == 0) { if (ret == 0) {
ret = copyin(uap->ucp, &uc, UC_COPY_SIZE); ret = copyin(uap->ucp, &uc, UC_COPY_SIZE);

View File

@ -747,7 +747,9 @@ thread_getcontext(struct thread *td, ucontext_t *uc)
#ifdef __i386__ #ifdef __i386__
get_mcontext(td, &uc->uc_mcontext); get_mcontext(td, &uc->uc_mcontext);
#endif #endif
PROC_LOCK(td->td_proc);
uc->uc_sigmask = td->td_sigmask; uc->uc_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
} }
/* /*

View File

@ -153,7 +153,9 @@ thr_create(struct thread *td, struct thr_create_args *uap)
(unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy)); (unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy));
td0->td_proc = td->td_proc; td0->td_proc = td->td_proc;
PROC_LOCK(td->td_proc);
td0->td_sigmask = td->td_sigmask; td0->td_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
bcopy(td->td_frame, td0->td_frame, sizeof(struct trapframe)); bcopy(td->td_frame, td0->td_frame, sizeof(struct trapframe));
td0->td_ucred = crhold(td->td_ucred); td0->td_ucred = crhold(td->td_ucred);

View File

@ -747,7 +747,9 @@ thread_getcontext(struct thread *td, ucontext_t *uc)
#ifdef __i386__ #ifdef __i386__
get_mcontext(td, &uc->uc_mcontext); get_mcontext(td, &uc->uc_mcontext);
#endif #endif
PROC_LOCK(td->td_proc);
uc->uc_sigmask = td->td_sigmask; uc->uc_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
} }
/* /*