Centos-kernel-stream-9/tools/bpf/bpftool
Yauheni Kaliuta 002bc665cb Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK"
Bugzilla: https://bugzilla.redhat.com/2120968

commit 6b4384ff108874cf336fe2fb1633313c2c7620bf
Author: Quentin Monnet <quentin@isovalent.com>
Date:   Fri Jun 10 12:26:47 2022 +0100

    Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK"
    
    This reverts commit a777e18f1bcd32528ff5dfd10a6629b655b05eb8.
    
    In commit a777e18f1bcd ("bpftool: Use libbpf 1.0 API mode instead of
    RLIMIT_MEMLOCK"), we removed the rlimit bump in bpftool, because the
    kernel has switched to memcg-based memory accounting. Thanks to the
    LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK, we attempted to keep compatibility
    with other systems and ask libbpf to raise the limit for us if
    necessary.
    
    How do we know if memcg-based accounting is supported? There is a probe
    in libbpf to check this. But this probe currently relies on the
    availability of a given BPF helper, bpf_ktime_get_coarse_ns(), which
    landed in the same kernel version as the memory accounting change. This
    works in the generic case, but it may fail, for example, if the helper
    function has been backported to an older kernel. This has been observed
    for Google Cloud's Container-Optimized OS (COS), where the helper is
    available but rlimit is still in use. The probe succeeds, the rlimit is
    not raised, and probing features with bpftool, for example, fails.
    
    A patch was submitted [0] to update this probe in libbpf, based on what
    the cilium/ebpf Go library does [1]. It would lower the soft rlimit to
    0, attempt to load a BPF object, and reset the rlimit. But it may induce
    some hard-to-debug flakiness if another process starts, or the current
    application is killed, while the rlimit is reduced, and the approach was
    discarded.
    
    As a workaround to ensure that the rlimit bump does not depend on the
    availability of a given helper, we restore the unconditional rlimit bump
    in bpftool for now.
    
      [0] https://lore.kernel.org/bpf/20220609143614.97837-1-quentin@isovalent.com/
      [1] https://github.com/cilium/ebpf/blob/v0.9.0/rlimit/rlimit.go#L39
    
    Signed-off-by: Quentin Monnet <quentin@isovalent.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Yafang Shao <laoar.shao@gmail.com>
    Cc: Stanislav Fomichev <sdf@google.com>
    Link: https://lore.kernel.org/bpf/20220610112648.29695-2-quentin@isovalent.com

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-11-30 12:47:07 +02:00
..
Documentation bpftool: Add support for subskeletons 2022-10-25 14:58:05 +02:00
bash-completion bpftool: Add support for subskeletons 2022-10-25 14:58:05 +02:00
skeleton bpftool: Add bpf_cookie to link output 2022-10-25 14:58:03 +02:00
.gitignore bpftool: Fix SPDX tag for Makefiles and .gitignore 2022-08-24 12:53:34 +02:00
Makefile Merge: BPF and XDP rebase to v5.18 2022-11-21 05:30:47 -05:00
btf.c bpftool: Use sysfs vmlinux when dumping BTF by ID 2022-11-30 12:47:04 +02:00
btf_dumper.c bpftool: Use bpf_obj_get_info_by_fd directly 2022-08-24 12:53:32 +02:00
cfg.c tools, bpftool: Poison and replace kernel integer typedefs 2020-05-11 21:20:46 +02:00
cfg.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cgroup.c bpftool: Adding support for BTF program names 2022-10-25 14:57:40 +02:00
common.c Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
feature.c Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
gen.c bpftool: bpf_link_get_from_fd support for LSM programs in lskel 2022-11-30 12:47:02 +02:00
iter.c bpftool: Use libbpf_get_error() to check error 2022-08-24 12:53:37 +02:00
jit_disasm.c bpftool: Properly close va_list 'ap' by va_end() on error 2021-07-06 09:19:23 +02:00
json_writer.c bpftool: Support dumping metadata 2020-09-15 18:28:27 -07:00
json_writer.h bpftool: Support dumping metadata 2020-09-15 18:28:27 -07:00
link.c bpf, x86: Generate trampolines from bpf_tramp_links 2022-11-30 12:47:03 +02:00
main.c Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
main.h Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
map.c Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
map_perf_ring.c bpftool: Update btf_dump__new() and perf_buffer__new_raw() calls 2022-08-24 12:53:35 +02:00
net.c bpftool: use new API for attaching XDP program 2022-10-25 14:57:41 +02:00
netlink_dumper.c bpftool: Use consistent include paths for libbpf 2020-01-20 16:37:45 -08:00
netlink_dumper.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
perf.c bpftool, musl compat: Replace nftw with FTW_ACTIONRETVAL 2022-11-28 16:52:11 +02:00
pids.c Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
prog.c Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
struct_ops.c Revert "bpftool: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK" 2022-11-30 12:47:07 +02:00
tracelog.c bpftool, musl compat: Replace sys/fcntl.h by fcntl.h 2022-11-28 16:52:11 +02:00
xlated_dumper.c bpftool: Remove usage of reallocarray() 2022-10-25 14:57:51 +02:00
xlated_dumper.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00