Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libbpf tcptop: Fix "unrecognized bpf_ld_imm64 insn" on 4.19 #4987

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bernhardkaindl
Copy link
Contributor

@bernhardkaindl bernhardkaindl commented May 6, 2024

Fix the BPF load error unrecognized bpf_ld_imm64 insn in tcptop on 4.19 by converting .rodata config variables to a map. (global data is not supported in 4.19)

tcptop can use CO-RE including on 4.19 when a detached vmlinux BTF file is provided.
It can be generated from a DWARF vmlinux using pahole:

pahole -J;objcopy --only-section=.BTF vmlinux /boot/vmlinux-$(uname -r)

PS: GitHub CI fails on a few test cases (flaky) so I added a minor commits to make CI less flaky.

Fix the BPF load error `unrecognized bpf_ld_imm64 insn`
on 4.19 by converting rodata config variables to a map.

tcptop can use CO-RE including 4.19 when a detached vmlinux BTF
file is provided, generated from a DWARF vmlinux using pahole:
pahole -J;objcopy --only-section=.BTF vmlinux /boot/vmlinux-$(uname -r)

Signed-off-by: Bernhard Kaindl <[email protected]>
@bernhardkaindl bernhardkaindl force-pushed the libbpf-tcptop-fix-unrecognized-ld_imm64 branch from 80a6345 to c237605 Compare May 8, 2024 19:34
@bernhardkaindl bernhardkaindl force-pushed the libbpf-tcptop-fix-unrecognized-ld_imm64 branch from b698ac3 to 8b03d14 Compare May 8, 2024 23:16
@@ -12,9 +12,12 @@
#define AF_INET 2 /* Internet IP Protocol */
#define AF_INET6 10 /* IP version 6 */

const volatile bool filter_cg = false;
const volatile pid_t target_pid = -1;
const volatile int target_family = -1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above coding pattern has been used in most of libbpf-tools bpf programs. I would rather to keep this. Changing to use map does not sound good compared to more elegant way in the above. 4.19 is quite old. Maybe you could folk the repo and make change in your private repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants