LoongArch: bpf: zero-extend signed ALU32 div/mod results#12755
Open
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Open
LoongArch: bpf: zero-extend signed ALU32 div/mod results#12755kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: 0e35b9b |
3873ca6 to
d66fa53
Compare
Author
|
Upstream branch: 7cbd0c4 |
c99b4e9 to
6af4129
Compare
Author
|
Upstream branch: 7cbd0c4 |
ALU32 operations write a 32-bit result and leave the upper 32 bits of the BPF register zero. The LoongArch JIT sign-extends the result of signed ALU32 BPF_DIV and BPF_MOD (off=1), so a negative 32-bit quotient or remainder leaves bits 63:32 set in JITted code while the verifier and interpreter model those bits as zero. Keep sign-extension on the operands, which signed divide needs, and zero-extend the ALU32 result after the divide or modulo instruction, matching the unsigned ALU32 div/mod paths and every other ALU32 operation in this JIT. Fixes: 2425c9e ("LoongArch: BPF: Support signed div instructions") Fixes: 7b6b13d ("LoongArch: BPF: Support signed mod instructions") Signed-off-by: Nicholas Dudar <main.kalliope@gmail.com> Assisted-by: Claude:claude-opus-4-8 Acked-by: Tiezhu Yang <yangtiezhu@loongson.cn> Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
6af4129 to
6b08863
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: LoongArch: bpf: zero-extend signed ALU32 div/mod results
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124752