summaryrefslogtreecommitdiff
path: root/arch/sparc
diff options
context:
space:
mode:
authorBjörn Töpel <bjorn.topel@gmail.com>2019-05-21 15:46:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-14 08:09:35 +0200
commita1dbf72838b0f889d9c846076235eee527372d8f (patch)
treedf550eeb02ed16edd2225ad4a454e5b22bedb629 /arch/sparc
parent3ab0e4bc01ef66567c7ddb39321d76428300fc08 (diff)
bpf, riscv: clear target register high 32-bits for and/or/xor on ALU32
[ Upstream commit fe121ee531d1362810bfd30f38a1b88b1d3d376c ] When using 32-bit subregisters (ALU32), the RISC-V JIT would not clear the high 32-bits of the target register and therefore generate incorrect code. E.g., in the following code: $ cat test.c unsigned int f(unsigned long long a, unsigned int b) { return (unsigned int)a & b; } $ clang-9 -target bpf -O2 -emit-llvm -S test.c -o - | \ llc-9 -mattr=+alu32 -mcpu=v3 .text .file "test.c" .globl f .p2align 3 .type f,@function f: r0 = r1 w0 &= w2 exit .Lfunc_end0: .size f, .Lfunc_end0-f The JIT would not clear the high 32-bits of r0 after the and-operation, which in this case might give an incorrect return value. After this patch, that is not the case, and the upper 32-bits are cleared. Reported-by: Jiong Wang <jiong.wang@netronome.com> Fixes: 2353ecc6f91f ("bpf, riscv: add BPF JIT for RV64G") Signed-off-by: Björn Töpel <bjorn.topel@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/sparc')
0 files changed, 0 insertions, 0 deletions