Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate all ALU32 except for byte swap #454

Closed
wants to merge 1 commit into from

Conversation

Alan-Jowett
Copy link
Collaborator

Resolves: #452

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.

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
@Alan-Jowett Alan-Jowett closed this May 8, 2024
@Alan-Jowett Alan-Jowett deleted the issue452 branch May 28, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

32bit ALU operations fail to truncate target register
1 participant