summaryrefslogtreecommitdiffstats
path: root/sys/security
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-04-17 21:38:18 +0000
committerrwatson <rwatson@FreeBSD.org>2008-04-17 21:38:18 +0000
commitca47fccd6b260693108c5ee5634bd0e011c67f5e (patch)
treefd64d5b5062ffc1979994100cac82014c5ed48b6 /sys/security
parent3e83d6e7db0e2c7d805fd36da3475e635fbb4b3e (diff)
downloadFreeBSD-src-ca47fccd6b260693108c5ee5634bd0e011c67f5e.zip
FreeBSD-src-ca47fccd6b260693108c5ee5634bd0e011c67f5e.tar.gz
Convert pcbinfo and inpcb mutexes to rwlocks, and modify macros to
explicitly select write locking for all use of the inpcb mutex. Update some pcbinfo lock assertions to assert locked rather than write-locked, although in practice almost all uses of the pcbinfo rwlock main exclusive, and all instances of inpcb lock acquisition are exclusive. This change should introduce (ideally) little functional change. However, it lays the groundwork for significantly increased parallelism in the TCP/IP code. MFC after: 3 months Tested by: kris (superset of committered patch)
Diffstat (limited to 'sys/security')
-rw-r--r--sys/security/audit/audit_arg.c4
-rw-r--r--sys/security/mac/mac_inet.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/security/audit/audit_arg.c b/sys/security/audit/audit_arg.c
index 309b90d..ffdfde6 100644
--- a/sys/security/audit/audit_arg.c
+++ b/sys/security/audit/audit_arg.c
@@ -649,7 +649,7 @@ audit_arg_file(struct proc *p, struct file *fp)
so->so_proto->pr_protocol;
SOCK_UNLOCK(so);
pcb = (struct inpcb *)so->so_pcb;
- INP_LOCK(pcb);
+ INP_WLOCK(pcb);
ar->k_ar.ar_arg_sockinfo.so_raddr =
pcb->inp_faddr.s_addr;
ar->k_ar.ar_arg_sockinfo.so_laddr =
@@ -658,7 +658,7 @@ audit_arg_file(struct proc *p, struct file *fp)
pcb->inp_fport;
ar->k_ar.ar_arg_sockinfo.so_lport =
pcb->inp_lport;
- INP_UNLOCK(pcb);
+ INP_WUNLOCK(pcb);
ARG_SET_VALID(ar, ARG_SOCKINFO);
}
break;
diff --git a/sys/security/mac/mac_inet.c b/sys/security/mac/mac_inet.c
index 6533cf0..0445d91 100644
--- a/sys/security/mac/mac_inet.c
+++ b/sys/security/mac/mac_inet.c
@@ -201,7 +201,7 @@ mac_inpcb_create_mbuf(struct inpcb *inp, struct mbuf *m)
{
struct label *mlabel;
- INP_LOCK_ASSERT(inp);
+ INP_WLOCK_ASSERT(inp);
mlabel = mac_mbuf_to_label(m);
MAC_PERFORM(inpcb_create_mbuf, inp, inp->inp_label, m, mlabel);
@@ -306,7 +306,7 @@ void
mac_inpcb_sosetlabel(struct socket *so, struct inpcb *inp)
{
- INP_LOCK_ASSERT(inp);
+ INP_WLOCK_ASSERT(inp);
SOCK_LOCK_ASSERT(so);
MAC_PERFORM(inpcb_sosetlabel, so, so->so_label, inp, inp->inp_label);
}
@@ -376,7 +376,7 @@ void
mac_syncache_create(struct label *label, struct inpcb *inp)
{
- INP_LOCK_ASSERT(inp);
+ INP_WLOCK_ASSERT(inp);
MAC_PERFORM(syncache_create, label, inp);
}
OpenPOWER on IntegriCloud