summaryrefslogtreecommitdiffstats
path: root/sys/net/bpfdesc.h
diff options
context:
space:
mode:
authorghelmer <ghelmer@FreeBSD.org>2012-12-10 16:14:44 +0000
committerghelmer <ghelmer@FreeBSD.org>2012-12-10 16:14:44 +0000
commit726beb3d43000997e7410621a0c31a65b05ebb31 (patch)
tree05f79a3e8fd1361998dd0dc02f1088df035c8960 /sys/net/bpfdesc.h
parent2160ff58527c3253bc5fe11f85c2e3d0fa680688 (diff)
downloadFreeBSD-src-726beb3d43000997e7410621a0c31a65b05ebb31.zip
FreeBSD-src-726beb3d43000997e7410621a0c31a65b05ebb31.tar.gz
Changes to resolve races in bpfread() and catchpacket() that, at worst,
cause kernel panics. Add a flag to the bpf descriptor to indicate whether the hold buffer is in use. In bpfread(), set the "hold buffer in use" flag before dropping the descriptor lock during the call to bpf_uiomove(). Everywhere else the hold buffer is used or changed, wait while the hold buffer is in use by bpfread(). Add a KASSERT in bpfread() after re-acquiring the descriptor lock to assist uncovering any additional hold buffer races.
Diffstat (limited to 'sys/net/bpfdesc.h')
-rw-r--r--sys/net/bpfdesc.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h
index 6d58cc3..496f0b3 100644
--- a/sys/net/bpfdesc.h
+++ b/sys/net/bpfdesc.h
@@ -63,6 +63,7 @@ struct bpf_d {
caddr_t bd_sbuf; /* store slot */
caddr_t bd_hbuf; /* hold slot */
caddr_t bd_fbuf; /* free slot */
+ int bd_hbuf_in_use; /* don't rotate buffers */
int bd_slen; /* current length of store buffer */
int bd_hlen; /* current length of hold buffer */
OpenPOWER on IntegriCloud