diff options
author | mjg <mjg@FreeBSD.org> | 2014-07-01 06:29:15 +0000 |
---|---|---|
committer | mjg <mjg@FreeBSD.org> | 2014-07-01 06:29:15 +0000 |
commit | cd12aa0ab76d9d3638dc079c863eb0c93393a4d4 (patch) | |
tree | 15805b7664026e435cc0ad0e61cecaebc5c79dc6 /sys/kern/kern_exec.c | |
parent | 4255a1cf171f76390b00dae66c9e69da2c3558ca (diff) | |
download | FreeBSD-src-cd12aa0ab76d9d3638dc079c863eb0c93393a4d4.zip FreeBSD-src-cd12aa0ab76d9d3638dc079c863eb0c93393a4d4.tar.gz |
Perform a lockless check in sigacts_shared.
It is used only during execve (i.e. singlethreaded), so there is no fear
of returning 'not shared' which soon becomes 'shared'.
While here reorganize the code a little to avoid proc lock/unlock in
shared case.
MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 53182db..91d161d 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -621,18 +621,17 @@ interpret: * handlers. In execsigs(), the new process will have its signals * reset. */ - PROC_LOCK(p); - oldcred = crcopysafe(p, newcred); if (sigacts_shared(p->p_sigacts)) { oldsigacts = p->p_sigacts; - PROC_UNLOCK(p); newsigacts = sigacts_alloc(); sigacts_copy(newsigacts, oldsigacts); - PROC_LOCK(p); - p->p_sigacts = newsigacts; } else oldsigacts = NULL; + PROC_LOCK(p); + if (oldsigacts) + p->p_sigacts = newsigacts; + oldcred = crcopysafe(p, newcred); /* Stop profiling */ stopprofclock(p); |