All network processing contexts, with the exception of hardware
interrupt handlers, are now process contexts. That means the SPL
protection is no longer needed inside the NET_LOCK().
So the diff below removes the splsofnet()/splx() dance from the
NET_LOCK(). I'm not changing the NET_LOCK() macro in the same
diff in case we find some unexpected bugs and need to revert this
change.
ok?
Index: sys/systm.h
===================================================================
RCS file: /cvs/src/sys/sys/systm.h,v
retrieving revision 1.131
diff -u -p -r1.131 systm.h
--- sys/systm.h 29 May 2017 12:12:35 -0000 1.131
+++ sys/systm.h 3 Jul 2017 09:54:27 -0000
@@ -299,12 +299,12 @@ extern struct rwlock netlock;
#define NET_LOCK(s)
\
do { \
rw_enter_write(&netlock); \
- s = splsoftnet(); \
+ (void)s; \
} while (0)
#define NET_UNLOCK(s)
\
do { \
- splx(s); \
+ (void)s; \
rw_exit_write(&netlock); \
} while (0)
@@ -312,7 +312,6 @@ do {
\
do { \
if (rw_status(&netlock) != RW_WRITE) \
splassert_fail(RW_WRITE, rw_status(&netlock), __func__);\
- splsoftassert(IPL_SOFTNET); \
} while (0)
#define NET_ASSERT_UNLOCKED()
\
Index: kern/uipc_socket2.c
===================================================================
RCS file: /cvs/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.80
diff -u -p -r1.80 uipc_socket2.c
--- kern/uipc_socket2.c 27 Jun 2017 12:02:43 -0000 1.80
+++ kern/uipc_socket2.c 3 Jul 2017 10:13:18 -0000
@@ -279,9 +277,10 @@ solock(struct socket *so)
if ((so->so_proto->pr_domain->dom_family != PF_LOCAL) &&
(so->so_proto->pr_domain->dom_family != PF_ROUTE) &&
- (so->so_proto->pr_domain->dom_family != PF_KEY))
+ (so->so_proto->pr_domain->dom_family != PF_KEY)) {
NET_LOCK(s);
- else
+ s = IPL_SOFTNET; /* arbitrary value */
+ } else
s = -42;
return (s);