This pull request primarily focuses on modifications to the ubpf_vm package, specifically the translate function in ubpf_jit_x86_64.c and the ubpf_exec function in ubpf_vm.c. The changes are centered around the handling of ALU32 instructions. In both functions, additional code has been added to check if an instruction is an ALU32 instruction and perform certain operations if it is.
Here are the key changes:
vm/ubpf_jit_x86_64.c: In the translate function, a check has been added to identify if an instruction is an ALU32 instruction. If it is, the target register is truncated to 32 bits using the emit_truncate_u32 function.
vm/ubpf_vm.c: Similar to the translate function, the ubpf_exec function now checks if an instruction is an ALU32 instruction. If it is, the destination register (inst.dst) is bitwise ANDed with UINT32_MAX to ensure it only retains the lower 32 bits of the value.
Resolves: #452
This pull request primarily focuses on modifications to the
ubpf_vm
package, specifically thetranslate
function inubpf_jit_x86_64.c
and theubpf_exec
function inubpf_vm.c
. The changes are centered around the handling of ALU32 instructions. In both functions, additional code has been added to check if an instruction is an ALU32 instruction and perform certain operations if it is.Here are the key changes:
vm/ubpf_jit_x86_64.c
: In thetranslate
function, a check has been added to identify if an instruction is an ALU32 instruction. If it is, the target register is truncated to 32 bits using theemit_truncate_u32
function.vm/ubpf_vm.c
: Similar to thetranslate
function, theubpf_exec
function now checks if an instruction is an ALU32 instruction. If it is, the destination register (inst.dst
) is bitwise ANDed withUINT32_MAX
to ensure it only retains the lower 32 bits of the value.