mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
s390/bpf: fix lcgr instruction encoding
[ Upstream commitbb2d267c44] "masking, test in bounds 3" fails on s390, because BPF_ALU64_IMM(BPF_NEG, BPF_REG_2, 0) ignores the top 32 bits of BPF_REG_2. The reason is that JIT emits lcgfr instead of lcgr. The associated comment indicates that the code was intended to emit lcgr in the first place, it's just that the wrong opcode was used. Fix by using the correct opcode. Fixes:0546231057("s390/bpf: Add s390x eBPF JIT compiler backend") Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c1e0937ef4
commit
73d003274a
@@ -841,7 +841,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
|
||||
break;
|
||||
case BPF_ALU64 | BPF_NEG: /* dst = -dst */
|
||||
/* lcgr %dst,%dst */
|
||||
EMIT4(0xb9130000, dst_reg, dst_reg);
|
||||
EMIT4(0xb9030000, dst_reg, dst_reg);
|
||||
break;
|
||||
/*
|
||||
* BPF_FROM_BE/LE
|
||||
|
||||
Reference in New Issue
Block a user