diff options
author | 2019-08-12 17:03:32 +0200 | |
---|---|---|
committer | 2019-08-12 18:03:35 +0200 | |
commit | bb2d267c448f4bc3a3389d97c56391cb779178ae (patch) | |
tree | aaa921c0da8814d38672b391a2dbd63d3747329c /arch | |
parent | net: tc35815: Explicitly check NET_IP_ALIGN is not zero in tc35815_rx (diff) | |
download | linux-bb2d267c448f4bc3a3389d97c56391cb779178ae.tar.gz linux-bb2d267c448f4bc3a3389d97c56391cb779178ae.tar.bz2 linux-bb2d267c448f4bc3a3389d97c56391cb779178ae.zip |
s390/bpf: fix lcgr instruction encoding
"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: 054623105728 ("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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/net/bpf_jit_comp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index e636728ab452..6299156f9738 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -863,7 +863,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 |