FreeBSD Bugzilla – Attachment 57685 Details for
Bug 87014
BPF_MTAP/bpf_mtap are not threadsafe and cause panics on SMP systems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
BPFMTAP.difftxt
BPFMTAP.difftxt (text/plain), 2.19 KB, created by
Mark Gooderum
on 2005-10-07 06:03:12 UTC
(
hide
)
Description:
BPFMTAP.difftxt
Filename:
MIME Type:
Creator:
Mark Gooderum
Created:
2005-10-07 06:03:12 UTC
Size:
2.19 KB
patch
obsolete
>--- /tmp/tmp.44835.0 Fri Oct 7 00:00:08 2005 >+++ freebsd5/sys/net/bpf.c Thu Oct 6 16:34:36 2005 >@@ -81,20 +81,27 @@ > /* > * The default read buffer size is patchable. > */ > static int bpf_bufsize = 4096; > SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW, > &bpf_bufsize, 0, ""); > static int bpf_maxbufsize = BPF_MAXBUFSIZE; > SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW, > &bpf_maxbufsize, 0, ""); > >+static int bpf_nullhits; >+static int bpf_donullfix = 1; >+SYSCTL_INT(_debug, OID_AUTO, bpf_nullfix, CTLFLAG_RW, >+ &bpf_donullfix, 0, "Apply the BPF null BP workaround"); >+SYSCTL_INT(_debug, OID_AUTO, bpf_nullhits, CTLFLAG_RW, >+ &bpf_nullhits, 0, "# of bpf_mtap/2() workarounds fired"); >+ > /* > * bpf_iflist is the list of interfaces; each corresponds to an ifnet > */ > static LIST_HEAD(, bpf_if) bpf_iflist; > static struct mtx bpf_mtx; /* bpf global lock */ > > static int bpf_allocbufs(struct bpf_d *); > static void bpf_attachd(struct bpf_d *d, struct bpf_if *bp); > static void bpf_detachd(struct bpf_d *d); > static void bpf_freed(struct bpf_d *); >@@ -1201,20 +1208,31 @@ > */ > void > bpf_mtap(bp, m) > struct bpf_if *bp; > struct mbuf *m; > { > struct bpf_d *d; > u_int pktlen, slen; > > /* >+ * We can sometimes be invoked w/NULL bp due to a small race in >+ * BPF_MTAP(), see PR#xxxxx. >+ */ >+ if (bpf_donullfix) { >+ if (!bp) { >+ bpf_nullhits++; >+ return; >+ } >+ } >+ >+ /* > * Lockless read to avoid cost of locking the interface if there are > * no descriptors attached. > */ > if (LIST_EMPTY(&bp->bif_dlist)) > return; > > pktlen = m_length(m, NULL); > if (pktlen == m->m_len) { > bpf_tap(bp, mtod(m, u_char *), pktlen); > return; >@@ -1245,20 +1263,31 @@ > void > bpf_mtap2(bp, data, dlen, m) > struct bpf_if *bp; > void *data; > u_int dlen; > struct mbuf *m; > { > struct mbuf mb; > struct bpf_d *d; > u_int pktlen, slen; >+ >+ /* >+ * We can sometimes be invoked w/NULL bp due to a small race in >+ * BPF_MTAP2(), see PR#xxxxx. >+ */ >+ if (bpf_donullfix) { >+ if (!bp) { >+ bpf_nullhits++; >+ return; >+ } >+ } > > /* > * Lockless read to avoid cost of locking the interface if there are > * no descriptors attached. > */ > if (LIST_EMPTY(&bp->bif_dlist)) > return; > > pktlen = m_length(m, NULL); > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 87014
:
57683
|
57684
| 57685