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

elf bpf_probe_read to bpf_probe_read_kernel rewrite port from libbpf #276

Open
jasonk000 opened this issue Feb 9, 2021 · 0 comments
Open

Comments

@jasonk000
Copy link

Kernel has changed to use bpf_probe_read_kernel instead of bpf_probe_read which is resulting in some issues with an ELF binary and attached kprobe. Compiling the ELF file to use bpf_probe_read_kernel resolves it; however that makes the ELF file not backwards compatible.

Libbpf handles this by detecting the available feature and performing a rewrite of the instructions as shown here.

There is no currently no sanitization step, in gobpf, so it would need to be built.

If there is interest I'd be happy to draft a patch. I expect a new function called by elf.go:Load around line 537 or line 833 to rewrite the insns at that point would resolve it. Some integration to detect kernel features would also be needed.

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

No branches or pull requests

1 participant