Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: libbpf/libbpf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.4.4
Choose a base ref
...
head repository: libbpf/libbpf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.4.5
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 11, 2024

  1. libbpf: detect broken PID filtering logic for multi-uprobe

    Libbpf is automatically (and transparently to user) detecting
    multi-uprobe support in the kernel, and, if supported, uses
    multi-uprobes to improve USDT attachment speed.
    
    USDTs can be attached system-wide or for the specific process by PID. In
    the latter case, we rely on correct kernel logic of not triggering USDT
    for unrelated processes.
    
    As such, on older kernels that do support multi-uprobes, but still have
    broken PID filtering logic, we need to fall back to singular uprobes.
    
    Unfortunately, whether user is using PID filtering or not is known at
    the attachment time, which happens after relevant BPF programs were
    loaded into the kernel. Also unfortunately, we need to make a call
    whether to use multi-uprobes or singular uprobe for SEC("usdt") programs
    during BPF object load time, at which point we have no information about
    possible PID filtering.
    
    The distinction between single and multi-uprobes is small, but important
    for the kernel. Multi-uprobes get BPF_TRACE_UPROBE_MULTI attach type,
    and kernel internally substitiute different implementation of some of
    BPF helpers (e.g., bpf_get_attach_cookie()) depending on whether uprobe
    is multi or singular. So, multi-uprobes and singular uprobes cannot be
    intermixed.
    
    All the above implies that we have to make an early and conservative
    call about the use of multi-uprobes. And so this patch modifies libbpf's
    existing feature detector for multi-uprobe support to also check correct
    PID filtering. If PID filtering is not yet fixed, we fall back to
    singular uprobes for USDTs.
    
    This extension to feature detection is simple thanks to kernel's -EINVAL
    addition for pid < 0.
    
    Acked-by: Jiri Olsa <jolsa@kernel.org>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20240521163401.3005045-4-andrii@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    (cherry picked from commit d9f9fd5)
    anakryiko committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    ebd40ad View commit details
    Browse the repository at this point in the history
  2. libbpf: bump version to v1.4.5

    Bump patch version to prepare for v1.4.5
    
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    anakryiko committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    a508615 View commit details
    Browse the repository at this point in the history
Loading