iovisor/ubpf

Incorrect exit implementation in JIT compiler

pcy190 opened this issue · 1 comments

When we run PoC program in the JIT compiler, we get the return value as 224 after execution. While the correct return value should be 0.
The code generation implementation of EBPF_OP_EXIT in JIT compiler does not correctly handle the initial r0 value.

mov %r2, 0xFFFFFFFF
exit

We observed the following inconsistency:

// result after program execution
interpreter: 0
JIT: 224

This is undefined behavior from a malformed program. I have a PR #445 to add a runtime check in the interpreter to reject this.