summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_context.c6
-rw-r--r--sys/kern/kern_kse.c2
-rw-r--r--sys/kern/kern_thr.c2
-rw-r--r--sys/kern/kern_thread.c2
4 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/kern_context.c b/sys/kern/kern_context.c
index ffb3f95..653475d 100644
--- a/sys/kern/kern_context.c
+++ b/sys/kern/kern_context.c
@@ -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);
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index bfc97ad..784d45b 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -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);
}
/*
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index c2a2103..488cf6f 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -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);
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index bfc97ad..784d45b 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -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);
}
/*
OpenPOWER on IntegriCloud