Module bpf_pin

Module bpf_pin 

Source
Expand description

Guest-side BPF map fd pinning. See crate::scenario::ops::Op::PinBpfMap for the full motivation; in short, the same-binary Op::ReplaceScheduler swap window’s multi-bss case (two <obj>.bss copies coexisting while the dying scheduler’s BPF object is being torn down) only fires when both copies are still alive at freeze time, and the kernel frees the dying instance’s maps as soon as libbpf drops their fds. Holding an extra refcount via this helper keeps the dying scheduler’s map alive long enough for at least one post-swap freeze to observe both copies, which is what the framework’s crate::scenario::snapshot::Snapshot::active plus walker disambiguation chain exists to handle.

Functions§

open_bpf_map_fd_by_name
Walk the kernel’s BPF map ID space, find the first map whose bpf_map_info.name matches name, return its OwnedFd. The caller holds the returned fd to keep the map alive (the kernel refcount only drops to zero once every fd holder releases).