lkml.org 
[lkml]   [2019]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.4 35/56] s390/bpf: fix lcgr instruction encoding
    Date
    From: Ilya Leoshkevich <iii@linux.ibm.com>

    [ Upstream commit bb2d267c448f4bc3a3389d97c56391cb779178ae ]

    "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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    arch/s390/net/bpf_jit_comp.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
    index 727693e283da2..e53d410e88703 100644
    --- a/arch/s390/net/bpf_jit_comp.c
    +++ b/arch/s390/net/bpf_jit_comp.c
    @@ -886,7 +886,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
    --
    2.20.1


    \
     
     \ /
      Last update: 2019-09-20 00:24    [W:4.200 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site