qmonnet / rbpf

Rust virtual machine and JIT compiler for eBPF programs
Apache License 2.0
922 stars 235 forks source link

src/interpreter.rs: Fix arithmetic left/right shift implementation (mask offset) #102

Closed pcy190 closed 7 months ago

pcy190 commented 7 months ago

Fix #101

We mask the mask offset for arithmetic shifts operaitons. The current version of the BPF Instruction Set Specification specifies that "Shift operations use a mask of 0x3F (63) for 64-bit operations and 0x1F (31) for 32-bit operations" 0.

pcy190 commented 7 months ago

Seems that the casting should be rewritten.

qmonnet commented 7 months ago

And thanks a lot!!