Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit a45b402b authored by Xi Wang's avatar Xi Wang Committed by Sasha Levin
Browse files

arm64: bpf: fix signedness bug in loading 64-bit immediate


[ Upstream commit 1e4df6b7 ]

Consider "(u64)insn1.imm << 32 | imm" in the arm64 JIT.  Since imm is
signed 32-bit, it is sign-extended to 64-bit, losing the high 32 bits.
The fix is to convert imm to u32 first, which will be zero-extended to
u64 implicitly.

Cc: Zi Shen Lim <zlim.lnx@gmail.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org>
Fixes: 30d3d94c ("arm64: bpf: add 'load 64-bit immediate' instruction")
Signed-off-by: default avatarXi Wang <xi.wang@gmail.com>
[will: removed non-arm64 bits and redundant casting]
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>

Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 748e016c
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment