Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Feb 2007 17:23:08 GMT
From:      "Christian S.J. Peron" <csjp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 114188 for review
Message-ID:  <200702071723.l17HN8Yo023899@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114188

Change 114188 by csjp@csjp_rnd01 on 2007/02/07 17:22:19

	Dont try to free a pointer which references packets within
	mmaped pages. This explains why things seemed to randomly
	segfault on SIGINT

Affected files ...

.. //depot/projects/zcopybpf/src/contrib/libpcap/pcap-bpf.c#7 edit

Differences ...

==== //depot/projects/zcopybpf/src/contrib/libpcap/pcap-bpf.c#7 (text+ko) ====

@@ -1245,9 +1245,17 @@
 		munmap(p->zbuf1, v);
 	if (p->zbuf2 != NULL)
 		munmap(p->zbuf2, v);
-#endif
+	/*
+	 * If we are using zerocopy, the packet buffer will be referencing
+	 * an address in one of the shared pages, if any.  In which case
+	 * we will not free it.
+	 */
+	if (getenv("BPF_ZERO_COPY") == NULL && p->buffer != NULL)
+		free(p->buffer);
+#else
 	if (p->buffer != NULL)
 		free(p->buffer);
+#endif
 	if (p->dlt_list != NULL)
 		free(p->dlt_list);
 	free(p);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702071723.l17HN8Yo023899>