summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2020-05-26 14:58:55 +0000
committervisa <visa@openbsd.org>2020-05-26 14:58:55 +0000
commit66ee2439ad807b20a8c3e105bb6774d39e39043b (patch)
treee5d9c594c1718d9f3e09a3d79879c34d73ddebd2 /sys/net/if.c
parentRewrite the entropy enqueue ring to collect damage asyncronously, and adapt the (diff)
downloadwireguard-openbsd-66ee2439ad807b20a8c3e105bb6774d39e39043b.tar.xz
wireguard-openbsd-66ee2439ad807b20a8c3e105bb6774d39e39043b.zip
Extract more randomness from mbuf flow
Input bits of the mbuf list head to enqueue_randomness(). While the set of mbufs in circulation is relatively stable, the order in which they reach if_input_process() is unpredictable. Shuffling can happen in many subsystems, such as the network stack, device drivers, and memory management. OK deraadt@ mpi@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 176fcf849fd..b3a4e857598 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.603 2020/04/12 07:04:03 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.604 2020/05/26 14:58:55 visa Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -85,6 +85,7 @@
#include <sys/atomic.h>
#include <sys/percpu.h>
#include <sys/proc.h>
+#include <sys/stdint.h> /* uintptr_t */
#include <dev/rndvar.h>
@@ -924,7 +925,7 @@ if_input_process(struct ifnet *ifp, struct mbuf_list *ml)
return;
if (!ISSET(ifp->if_xflags, IFXF_CLONED))
- enqueue_randomness(ml_len(ml));
+ enqueue_randomness(ml_len(ml) ^ (uintptr_t)MBUF_LIST_FIRST(ml));
/*
* We grab the NET_LOCK() before processing any packet to