diff options
author | 2016-12-29 12:12:43 +0000 | |
---|---|---|
committer | 2016-12-29 12:12:43 +0000 | |
commit | 46e95b1078f0248a4fec4cb55652cb1c998de532 (patch) | |
tree | 25a1cb9092c1e6a77b3a409b02c7fe7d97608a76 /sys/kern/uipc_socket.c | |
parent | Release the NET_LOCK() before calling unp_connect(). It is not possible (diff) | |
download | wireguard-openbsd-46e95b1078f0248a4fec4cb55652cb1c998de532.tar.xz wireguard-openbsd-46e95b1078f0248a4fec4cb55652cb1c998de532.zip |
Change NET_LOCK()/NET_UNLOCK() to be simple wrappers around
splsoftnet()/splx() until the known issues are fixed.
In other words, stop using a rwlock since it creates a deadlock when
chrome is used.
Issue reported by Dimitris Papastamos and kettenis@
ok visa@
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 3a9d7b47982..245210e594a 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.170 2016/12/20 21:15:36 mpi Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.171 2016/12/29 12:12:43 mpi Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -256,7 +256,7 @@ soclose(struct socket *so) (so->so_state & SS_NBIO)) goto drop; while (so->so_state & SS_ISCONNECTED) { - error = rwsleep(&so->so_timeo, &netlock, + error = tsleep(&so->so_timeo, PSOCK | PCATCH, "netcls", so->so_linger * hz); if (error) @@ -615,7 +615,7 @@ sbsync(struct sockbuf *sb, struct mbuf *nextrecord) * followed by an optional mbuf or mbufs containing ancillary data, * and then zero or more mbufs of data. * In order to avoid blocking network for the entire time here, we splx() - * and release ``netlock'' while doing the actual copy to user space. + * and release NET_LOCK() while doing the actual copy to user space. * Although the sockbuf is locked, new data may still be appended, * and thus we must maintain consistency of the sockbuf during that time. * @@ -1039,7 +1039,7 @@ sorflush(struct socket *so) struct sockbuf asb; sb->sb_flags |= SB_NOINTR; - (void) sblock(sb, M_WAITOK, &netlock); + (void) sblock(sb, M_WAITOK, NULL); socantrcvmore(so); sbunlock(sb); asb = *sb; @@ -1528,10 +1528,7 @@ sorwakeup(struct socket *so) #endif sowakeup(so, &so->so_rcv); if (so->so_upcall) { - /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); (*(so->so_upcall))(so, so->so_upcallarg, M_DONTWAIT); - rw_enter_write(&netlock); } } |