summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2026-09-04 21:44:43 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-09-04 21:44:43 +0800
commit30419a0aa128135a81be917eaa3bd2f1a10c9ca3 (patch)
tree6a1631e831a65d7d08e92b0903c89ea402815f16 /scripts/Makefile.thinlto
parent72ce4b24676e8b3b75376c4c559dd81c1ac52d5a (diff)
LoongArch: BPF: Fix off-by-one error for insn_is_cast_user()
In the LoongArch BPF JIT code, the branch offset represents the number of instructions. An offset of 1 means the target of the "beq" is the current PC plus 1 instruction (PC + 4 bytes). This matches the exact same path as the sequential non-branch execution, the "or" instruction is always executed for the cast_user JIT arm in build_insn(). If the pointer is not NULL, there is no side effect. But if the pointer is NULL, it is incorrectly combined with the base address and turns into a non-zero address, meaning a zero arena offset no longer casts to NULL. Fix this by changing the branch offset from 1 to 2, which properly skips the "or" instruction and jumps directly to the "move_reg" instruction if the pointer is NULL, ensuring the destination register is safely cleared to 0. Cc: stable@vger.kernel.org Fixes: 4fdb5dd8aeba ("LoongArch: BPF: Implement bpf_addr_space_cast instruction") Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions