Protect td_sigmask with the proc lock.

This commit is contained in:
John Baldwin 2003-04-17 22:21:57 +00:00
parent 538621734a
commit 94df4b8584
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113626
4 changed files with 11 additions and 1 deletions

View File

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

View File

@ -747,7 +747,9 @@ thread_getcontext(struct thread *td, ucontext_t *uc)
#ifdef __i386__
get_mcontext(td, &uc->uc_mcontext);
#endif
PROC_LOCK(td->td_proc);
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));
td0->td_proc = td->td_proc;
PROC_LOCK(td->td_proc);
td0->td_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
bcopy(td->td_frame, td0->td_frame, sizeof(struct trapframe));
td0->td_ucred = crhold(td->td_ucred);

View File

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