tcpdump mailing list archives

Re: HP-UX crash on inject while receiving


From: Guy Harris <guy () alum mit edu>
Date: Fri, 28 Jul 2006 17:23:10 -0700


On Jul 28, 2006, at 12:51 PM, Harley Stenzel wrote:

Show that this happens when 2 threads use pcap_t at the same time:

libpcap is, for better or worse, not thread-safe, in the sense that no locking is done on the pcap_t structure to prevent concurrent accesses from stepping on each other, and no lock-free mechanisms are used when reading or writing the structure; using the same pcap_t in two threads isn't guaranteed to work. It might *happen* to work - and sending on a single pcap_t from multiple threads, for example, will probably work - but there aren't any guarantees.

Using *different* pcap_t's in two threads should work, although pcap- dlpi.c has static variables that it uses on HP-UX (ctlbuf and ctl), which is a clear botch unless getmsg() is guaranteed not to modify ctl.

However, the static variable isn't part of the inject code path, so that shouldn't be causing the crash. The claim from gdb is that

        dlp->dl_primitive = DL_HP_RAWDATA_REQ;

is crashing, but "dlp" just points to a buffer on the stack, which *should* be thread-safe. (The stack trace is a bit odd, given that the crash is in dlrawdatareq().)

-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.


Current thread: