nixpkgs/pkgs/os-specific/linux/libbpf/default.nix
Dominique Martinet da60cdbcb7 libbpf: 1.2.0 -> 1.2.2
1.2.1: Bug fix release:

Single bug fix (#1) that fixes regression in `perf` tool caused by libbpf
resetting its custom catch-all `SEC()` handler on explicit
`bpf_program__set_type()` call.

Given setting custom `SEC()` handlers is rarely used and pretty
esoteric feature of libbpf, most users should not be affected.

1.2.2: One more fix:

 - Fix (#2) possible double-free in USDT-related libbpf code, which
happens when libbpf runs out of space in `__bpf_usdt_specs` map due
to having too many unique USDT specs. Running out of space can be
mitigated by bumping up `BPF_USDT_MAX_SPEC_CNT` define before including
`bpf/usdt.bpf.h` header in BPF-side code.
This will prevent the double-free as a side effect (and will make it
possible to successfully attach all requested USDTs), which is a
recommended work-around for libbpf versions prior to v1.2.2.

Link: e4d3827e5d #1
Link: f117080307 #2
2023-07-14 15:15:45 +09:00

50 lines
1.2 KiB
Nix

{ fetchFromGitHub
, elfutils
, pkg-config
, stdenv
, zlib
, lib
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "libbpf";
version = "1.2.2";
src = fetchFromGitHub {
owner = "libbpf";
repo = "libbpf";
rev = "v${version}";
sha256 = "sha256-SDDdz2HKEfzHloLkb0sv5ldTo+1yJDVc9O7nj4Cjznk=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ elfutils zlib ];
enableParallelBuilding = true;
makeFlags = [ "PREFIX=$(out)" "-C src" ];
passthru.tests = {
bpf = nixosTests.bpf;
};
postInstall = ''
# install linux's libbpf-compatible linux/btf.h
install -Dm444 include/uapi/linux/*.h -t $out/include/linux
'';
# FIXME: Multi-output requires some fixes to the way the pkg-config file is
# constructed (it gets put in $out instead of $dev for some reason, with
# improper paths embedded). Don't enable it for now.
# outputs = [ "out" "dev" ];
meta = with lib; {
description = "Upstream mirror of libbpf";
homepage = "https://github.com/libbpf/libbpf";
license = with licenses; [ lgpl21 /* or */ bsd2 ];
maintainers = with maintainers; [ thoughtpolice vcunat saschagrunert martinetd ];
platforms = platforms.linux;
};
}