HomeFreeBSD

bpf: Fix BIOCPROMISC locking

Description

bpf: Fix BIOCPROMISC locking

BPF might put an interface in promiscuous mode when handling the
BIOCSDLT ioctl. When this happens, a flag is set in the BPF descriptor
so that the old interface can be restored when the BPF descriptor is
destroyed.

The BIOCPROMISC ioctl can also be used to put a BPF descriptor's
interface into promiscuous mode, but there was nothing synchronizing the
flag. Fix this by modifying the ioctl handler to acquire the global BPF
mutex, which is used to synchronize ifpromisc() calls elsewhere in BPF.

Reviewed by: kp, melifaro
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 220818ac030726c24cbf9df6df5c9d019993b875)

Details

Provenance
markjAuthored on Aug 5 2022, 8:25 PM
Parents
rG6ecf086d5a0c: altq: improve pfctl config time for large numbers of queues
Branches
Unknown
Tags
Unknown