diff options
author | davidxu <davidxu@FreeBSD.org> | 2002-10-28 07:37:06 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2002-10-28 07:37:06 +0000 |
commit | fb65dc6cd6e7f2518756ef29dae14ffb950cbc29 (patch) | |
tree | 7af4cb438f09b16504733ca41e7454baa359a2b5 /sys | |
parent | c7d5ab33a3ae1e59f9a7594070cdbf98edfc5a2b (diff) | |
download | FreeBSD-src-fb65dc6cd6e7f2518756ef29dae14ffb950cbc29.zip FreeBSD-src-fb65dc6cd6e7f2518756ef29dae14ffb950cbc29.tar.gz |
Close a race window in kse_create(): signal delivered after SIGPENDING call
but before we call kse_link().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_kse.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index 2b4ad4a..eb6db57 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -455,10 +455,6 @@ kse_create(struct thread *td, struct kse_create_args *uap) bcopy(&ke->ke_startcopy, &newke->ke_startcopy, RANGEOF(struct kse, ke_startcopy, ke_endcopy)); #endif - PROC_LOCK(p); - if (SIGPENDING(p)) - newke->ke_flags |= KEF_ASTPENDING; - PROC_UNLOCK(p); /* For the first call this may not have been set */ if (td->td_standin == NULL) { td->td_standin = thread_alloc(); @@ -469,6 +465,8 @@ kse_create(struct thread *td, struct kse_create_args *uap) else newkg = kg; kse_link(newke, newkg); + if (p->p_sflag & PS_NEEDSIGCHK) + newke->ke_flags |= KEF_ASTPENDING; newke->ke_mailbox = uap->mbx; newke->ke_upcall = mbx.km_func; bcopy(&mbx.km_stack, &newke->ke_stack, sizeof(stack_t)); diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 2b4ad4a..eb6db57 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -455,10 +455,6 @@ kse_create(struct thread *td, struct kse_create_args *uap) bcopy(&ke->ke_startcopy, &newke->ke_startcopy, RANGEOF(struct kse, ke_startcopy, ke_endcopy)); #endif - PROC_LOCK(p); - if (SIGPENDING(p)) - newke->ke_flags |= KEF_ASTPENDING; - PROC_UNLOCK(p); /* For the first call this may not have been set */ if (td->td_standin == NULL) { td->td_standin = thread_alloc(); @@ -469,6 +465,8 @@ kse_create(struct thread *td, struct kse_create_args *uap) else newkg = kg; kse_link(newke, newkg); + if (p->p_sflag & PS_NEEDSIGCHK) + newke->ke_flags |= KEF_ASTPENDING; newke->ke_mailbox = uap->mbx; newke->ke_upcall = mbx.km_func; bcopy(&mbx.km_stack, &newke->ke_stack, sizeof(stack_t)); |