ebpf
ebpf copied to clipboard
asm: allow negative constants for builtin function calls
The work to encode a platform into various constant types made it so that decoding a call to a builtin helper with a negative value fails with
decoding instructions for section <sectionname>:
offset <offset>: invalid constant 0xffffffff
for a BPF instruction of "call -1". This is because we can't represent -1 as a tagged platform constant.
Allow negative constants by not transforming them into a platform constant at all. Adjust the platform tag size so that we never generate a platform constant with the high bit set. This avoids confusing it with a negative number when reinterpreting it as a signed number and ensures that trying to marshal such an instruction gives an error.
Fixes: https://github.com/cilium/ebpf/issues/1797