qmonnet / rbpf

Rust virtual machine and JIT compiler for eBPF programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve program patching for context accesses

qmonnet opened this issue · comments

I pushed a branch called patch_prog that introduces a new module (patch) that proposes a function attempting to patch an eBPF program generated with clang, in order to make it compatible with rbpf.

The function is a dumb heuristic and is nowhere close to what happens in the kernel. See comments in the source code (module patch) for details. Implementing a more efficient algorithm does not look trivial (code in the kernel is GPL and we cannot reuse it).

I only tested it on a single example. If anyone has time to play with it and provide suggestions or feedback, that would be very welcome. Will try to update this issue if I can obtain better results.