Alan-Jowett / bpf_conformance

Measures the conformance of a BPF runtime to the ISA.
Other
25 stars 14 forks source link

Undefined behavior when a test attempts to compare values against stack pointers #293

Open RaoNikitha opened 1 month ago

RaoNikitha commented 1 month ago

The below test attempts to use r10 as a src register for JSLT. Libbpf and bpf2c both exhibit different undefined behavior. uBPF catches the error.

-- asm
mov %r1, 2
mov %r0, 1
jslt %r10, %r1, lbl
exit
lbl:
mov %r0, 0
exit
-- result
0x1

Test execution outcome across three different plugins:

bpf2c

PASS: Test succeeded

libbpf

FAIL: Plugin returned incorrect return value 0 expected 1

uBPF

ERROR: Plugin returned error code 1 and output Failed to load code: invalid destination register at PC 2