tcpdump mailing list archives

Re: Losing BPF's


From: Guy Harris <guy () alum mit edu>
Date: Tue, 20 Feb 2007 11:20:13 -0800

maneeshs wrote:

There seems to be a race condition in the above code, the check for the descriptor being free and the call to D_GET to mark the descriptor as being used is not atomic. So two closely spaced calls to bpfopen could cause bpf to use the same device twice ?

Yes, if, in OpenBSD, either

        1) you're on a multi-processor machine

or

        2) the kernel is preemptible

and there's no big lock around the kernel or around opens or around special-file opens or something else above the BPF open routine.

FreeBSD has a single global BPF mutex (bpf_mtx).
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: