cilium / ebpf

ebpf-go is a pure-Go library to read, modify and load eBPF programs and attach them to various hooks in the Linux kernel.
https://ebpf-go.dev
MIT License
6.39k stars 699 forks source link

btf: support CO-RE relocation of ISAv4 instructions #1213

Open lmb opened 1 year ago

lmb commented 1 year ago

1193 added support for new instructions. We need to extend COREFixup.Apply to recognise the new load / store modes.

### Tasks
- [ ] Check what libbpf does. Did the upstream patch sets make any changes to CO-RE logic?
- [ ] Implement the same in `COREFixup.Apply`
dylandreimerink commented 1 year ago

Check what libbpf does. Did the upstream patch sets make any changes to CO-RE logic?

As far as I can find the only change to libbpf for ISAv4 is https://github.com/libbpf/libbpf/commit/3d0e1c5a3a3157df9f1a6cc72d0b1d80b621ed75

No changes to the core logic around that same time https://github.com/libbpf/libbpf/commits/master/src/relo_core.c

And the BPF_MEMSX constant isn't used libbpf anywhere, so it seems like no action is required.

lmb commented 1 year ago

We'll need to adjust at least https://github.com/cilium/ebpf/blob/36f6316fb1690571ea9b722c4d227e1ba2d50f68/btf/core.go#L51 to allow the new class.