From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CC86C3A5A8 for ; Wed, 4 Sep 2019 16:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD93D22DBF for ; Wed, 4 Sep 2019 16:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567612988; bh=oAccNfbSXfw152/LAL/LhbXvHUYErX5skTH3a8n2azk=; h=From:To:Cc:Subject:Date:List-ID:From; b=MBSB9s5zIFwHqfrFad23PW9uLTfQfs+m8TUAaG9f0L75v0UepQYCCxsL20rqxgopc By4ceUpvA6fKelGW5+52xDaQJ8DteuSGlkeNdp5hnV3UDLSJuYjxcT5r+pWdUjxgXy Oum+/8k81W7XyQsbe3/HyahiDQ0VuARQb1ZNQCtI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387596AbfIDQDH (ORCPT ); Wed, 4 Sep 2019 12:03:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:39440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732666AbfIDQDF (ORCPT ); Wed, 4 Sep 2019 12:03:05 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 654DB2087E; Wed, 4 Sep 2019 16:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567612985; bh=oAccNfbSXfw152/LAL/LhbXvHUYErX5skTH3a8n2azk=; h=From:To:Cc:Subject:Date:From; b=Dgo+C948oYreM0S/Gg/y7JuUepTiIXXlTF8ML7FL4CoQt9Cl4TMEHMfV2rbNqrgpo 1+lWKwKWw9TsACNNcHNMXpXKJqdXA4lCroyJPTylAo0Eb5+TbqV284EjsNFBWEvRG0 ZU57er1qehx2nQhyUqAsbyGOiy26gjYv9nlOaZzs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ilya Leoshkevich , Vasily Gorbik , Daniel Borkmann , Sasha Levin , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 01/20] s390/bpf: fix lcgr instruction encoding Date: Wed, 4 Sep 2019 12:02:44 -0400 Message-Id: <20190904160303.5062-1-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ilya Leoshkevich [ 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 Acked-by: Vasily Gorbik Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- 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