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.6.0
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.6.1
Choose a head ref
  • 4 commits
  • 2 files changed
  • 3 contributors

Commits on Jul 19, 2025

  1. libbpf: Fix warning in calloc() usage

    When compiling libbpf with some compilers, this warning is triggered:
    
    libbpf.c: In function ‘bpf_object__gen_loader’:
    libbpf.c:9209:28: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
     9209 |         gen = calloc(sizeof(*gen), 1);
          |                            ^
    libbpf.c:9209:28: note: earlier argument should specify number of elements, later size of each element
    
    Fix this by inverting the calloc() arguments.
    
    Signed-off-by: Matteo Croce <teknoraver@meta.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Acked-by: Yonghong Song <yonghong.song@linux.dev>
    Link: https://lore.kernel.org/bpf/20250717200337.49168-1-technoboy85@gmail.com
    (cherry picked from commit a9dbcc3)
    teknoraver authored and anakryiko committed Jul 19, 2025
    Configuration menu
    Copy the full SHA
    c261b1c View commit details
    Browse the repository at this point in the history
  2. libbpf: Fix handling of BPF arena relocations

    Initial __arena global variable support implementation in libbpf
    contains a bug: it remembers struct bpf_map pointer for arena, which is
    used later on to process relocations. Recording this pointer is
    problematic because map pointers are not stable during ELF relocation
    collection phase, as an array of struct bpf_map's can be reallocated,
    invalidating all the pointers. Libbpf is dealing with similar issues by
    using a stable internal map index, though for BPF arena map specifically
    this approach wasn't used due to an oversight.
    
    The resulting behavior is non-deterministic issue which depends on exact
    layout of ELF object file, number of actual maps, etc. We didn't hit
    this until very recently, when this bug started triggering crash in BPF
    CI when validating one of sched-ext BPF programs.
    
    The fix is rather straightforward: we just follow an established pattern
    of remembering map index (just like obj->kconfig_map_idx, for example)
    instead of `struct bpf_map *`, and resolving index to a pointer at the
    point where map information is necessary.
    
    While at it also add debug-level message for arena-related relocation
    resolution information, which we already have for all other kinds of
    maps.
    
    Fixes: 2e7ba4f8fd1f ("libbpf: Recognize __arena global variables.")
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Tested-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20250718001009.610955-1-andrii@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    (cherry picked from commit fb66fb4)
    anakryiko committed Jul 19, 2025
    Configuration menu
    Copy the full SHA
    108f2a9 View commit details
    Browse the repository at this point in the history
  3. libbpf: Verify that arena map exists when adding arena relocations

    Fuzzer reported a memory access error in bpf_program__record_reloc()
    that happens when:
    - ".addr_space.1" section exists
    - there is a relocation referencing this section
    - there are no arena maps defined in BTF.
    
    Sanity checks for maps existence are already present in
    bpf_program__record_reloc(), hence this commit adds another one.
    
    [1] https://github.com/libbpf/libbpf/actions/runs/16375110681/job/46272998064
    
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20250718222059.281526-1-eddyz87@gmail.com
    (cherry picked from commit 8e59f80)
    eddyz87 authored and anakryiko committed Jul 19, 2025
    Configuration menu
    Copy the full SHA
    f80f1b1 View commit details
    Browse the repository at this point in the history
  4. libbpf: bump version to v1.6.1

    New patch version bump for v1.6.1.
    
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    anakryiko committed Jul 19, 2025
    Configuration menu
    Copy the full SHA
    ba4eca3 View commit details
    Browse the repository at this point in the history
Loading