Files
Jesper Dangaard Brouer 35883baaac bpf-link-hang: Adjust for newer libbpf API
bpf_object__find_program_by_title’ is deprecated: libbpf v0.7+:
 use bpf_object__find_program_by_name() instead

See: https://github.com/libbpf/libbpf/issues/297

 libbpf#297 Deprecate bpf_program__title() in favor of
 bpf_program__section_name(). “Title” term is confusing and
 unconventional, it’s SEC() in code and “section name” everywhere else.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2022-09-02 16:11:09 +02:00
..

Demonstration of close() hang on bpf_link fd close

This is a minimal example to demonstrate an issue where close()'ing an fd for a bpf_link kernel structure will hang indefinitely if the system is fully loaded. This only happens on a kernel compiled with CONFIG_PREEMPT=y, but on such a kernel the issue is quite easy to trigger: Simply load up the system (with work inside the kernel; sending it a lot of network traffic works pretty well), and run the bpf-link-hang program as root. The program will hang until load is lowered…

The hang happens in synchronize_rcu_tasks(), which can be seen with this bpftrace invocation:

bpftrace -e 'kprobe:synchronize_rcu_tasks { @start = nsecs; printf("enter\n"); } kretprobe:synchronize_rcu_tasks { printf("exit after %d ms\n", (nsecs - @start) / 1000000); }'