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=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 42366C43461 for ; Tue, 15 Sep 2020 19:25:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E509D206B2 for ; Tue, 15 Sep 2020 19:25:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NyLUVQbg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dcHWqN2/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E509D206B2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IeNWjfCtw4iqNMiP/fEyTNRpqOEfPzbS8MyVOnho6wE=; b=NyLUVQbgEAcO3BRIN0UFGpnpF cMPJ6KIb0veRNM1l/7a8kKrs34nRhnpeO+efeQMrlYEn0eUlDr+vIomh+PyN9qGM8NY1Ike9Tt4rp mwtNNvd8csPgwmCMlRUCPtbtFtP/XFYEJnXyBcDuvAvaJUJ1PjLswdfIfev9OOrk7U6XxaU3tPr0X tqLZeIIt8p3DhD3R2y1dK5jm8dtItUfcfuX4AOS0bauTIh7EAbn38evA+ISPud20FHTfOnkrp+XIW y3mqqE+jIit9aMr6nq3qPv7/vlZB7X9pwuWKIha8+Fx4tiFSRYNSwpVgfbmvvqAN+IVPgiVR/pnOO ByImxLHGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIGXv-0007E6-SY; Tue, 15 Sep 2020 19:23:19 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIGXs-0007Db-Uf for linux-arm-kernel@lists.infradead.org; Tue, 15 Sep 2020 19:23:18 +0000 Received: by mail-wr1-x444.google.com with SMTP id s12so4458129wrw.11 for ; Tue, 15 Sep 2020 12:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xaKrPrgrBMlaZS38zpubG0Tl9ZPTk+y0W+Heq7aSri0=; b=dcHWqN2/DpwqyJ5fhRCM5yW2IHn71hLOeS3/sZnQGLwIyf/rqUBIs0mMrs37jxjGsC aUJPjhHhH75YzNfcKKDhzSjWS9NroOCtTtDg4X86Jdcuck8eVhjYWVlC0uS2SijhVdZO kahp3K3RrtKDUAh9WJkNTOzneOz52ZNngoHCmWXhntdLPXlZwlqDA8OAHn2cnnSh/hws w0Lf8GyYxPBH8J6PlskI0Z6tLrR5zn1xFYiorSc6rvW6bz3mYY6Wi2qE3gfeAYdHRqhD vlpB94CQ7b3NmNoKWtNZh9+aho9deElmGArcuxe7Fpz3pwxNBwtEfQ9brq8TybDjSeE2 wQmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xaKrPrgrBMlaZS38zpubG0Tl9ZPTk+y0W+Heq7aSri0=; b=e3tM3+6AJAcHwdxJW/Rxg2C3M96lBmewfy5ji+M6r1vgb4FzKYjHT8kcFX2qqStS36 PehWzkIgd2KM3Rd0/xUG5DEyZRWhhK7A+ggJm0QM8uOdkwM393aaBAuH1FlLoOfnsZFi qr1F5E4T3pXJJA2k22DaHVNNi4vIbpfR5G7gjPOvQWalW8WwZb1buYqX0kS+7HhJO89o eI4WEvCxwSChOes6ov2dH8yjffUch1NjNNO8mbnNE0nL8pqvggQAsoCkUlJl5oHezUpj P6hiJ+1BBmSPgjYqKBYLyi86f9igoQIZcJqD+ZwjcKdtRpCQsIMGCy9L9P/iiTrhBkkK /ymw== X-Gm-Message-State: AOAM531NSWYlRGf5/cZGfXsc81z9mboGj7uWTYsne3Vi9ExDydisyi1Z C1n34VztG8OM+G3f6qI6TX/oTA== X-Google-Smtp-Source: ABdhPJxWQXdJLEG5oDeGFEeYUF/vrSRY9Tqwlwma5wZ2kLJYvIlIAvVSVcHO77MmmESpE8oFcvfKMA== X-Received: by 2002:a5d:6283:: with SMTP id k3mr23754401wru.191.1600197795717; Tue, 15 Sep 2020 12:23:15 -0700 (PDT) Received: from apalos.home (athedsl-246545.home.otenet.gr. [85.73.10.175]) by smtp.gmail.com with ESMTPSA id f23sm1651722wmc.3.2020.09.15.12.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 12:23:15 -0700 (PDT) Date: Tue, 15 Sep 2020 22:23:11 +0300 From: Ilias Apalodimas To: Will Deacon Subject: Re: [PATCH v2] arm64: bpf: Fix branch offset in JIT Message-ID: <20200915192311.GA124360@apalos.home> References: <20200914160355.19179-1-ilias.apalodimas@linaro.org> <20200915131102.GA26439@willie-the-truck> <20200915135344.GA113966@apalos.home> <20200915141707.GB26439@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200915141707.GB26439@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200915_152317_499491_B3D54E05 X-CRM114-Status: GOOD ( 20.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , Zi Shen Lim , Alexei Starovoitov , ardb@kernel.org, Jean-Philippe Brucker , Daniel Borkmann , naresh.kamboju@linaro.org, John Fastabend , Catalin Marinas , Jakub Kicinski , Andrii Nakryiko , Jesper Dangaard Brouer , Yonghong Song , KP Singh , linux-arm-kernel@lists.infradead.org, Yauheni Kaliuta , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Jiri Olsa , bpf@vger.kernel.org, Martin KaFai Lau Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Will, On Tue, Sep 15, 2020 at 03:17:08PM +0100, Will Deacon wrote: > On Tue, Sep 15, 2020 at 04:53:44PM +0300, Ilias Apalodimas wrote: > > On Tue, Sep 15, 2020 at 02:11:03PM +0100, Will Deacon wrote: > > > Hi Ilias, > > > > > > On Mon, Sep 14, 2020 at 07:03:55PM +0300, Ilias Apalodimas wrote: > > > > Running the eBPF test_verifier leads to random errors looking like this: > > > > > > > > [ 6525.735488] Unexpected kernel BRK exception at EL1 > > > > [ 6525.735502] Internal error: ptrace BRK handler: f2000100 [#1] SMP > > > > > > Does this happen because we poison the BPF memory with BRK instructions? > > > Maybe we should look at using a special immediate so we can detect this, > > > rather than end up in the ptrace handler. > > > > As discussed offline this is what aarch64_insn_gen_branch_imm() will return for > > offsets > 128M and yes replacing the handler with a more suitable message would > > be good. > > Can you give the diff below a shot, please? Hopefully printing a more useful > message will mean these things get triaged/debugged better in future. [...] The error print is going to be helpful imho. At least it will help people notice something is wrong a lot faster than the previous one. [ 575.273203] BPF JIT generated an invalid instruction at bpf_prog_64e6f4ba80861823_F+0x2e4/0x9a4! [ 575.281996] Unexpected kernel BRK exception at EL1 [ 575.286786] Internal error: BRK handler: f2000100 [#5] PREEMPT SMP [ 575.292965] Modules linked in: crct10dif_ce drm ip_tables x_tables ipv6 btrfs blake2b_generic libcrc32c xor xor_neon zstd_compress raid6_pq nvme nvme_core realtek [ 575.307516] CPU: 21 PID: 11760 Comm: test_verifier Tainted: G D W 5.9.0-rc3-01410-ged6d9b022813-dirty #1 [ 575.318125] Hardware name: Socionext SynQuacer E-series DeveloperBox, BIOS build #1 Jun 6 2020 [ 575.326825] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--) [ 575.332396] pc : bpf_prog_64e6f4ba80861823_F+0x2e4/0x9a4 [ 575.337705] lr : bpf_prog_d3e125b76c96daac+0x40/0xdec [ 575.342752] sp : ffff8000144e3ba0 [ 575.346061] x29: ffff8000144e3bd0 x28: 0000000000000000 [ 575.351371] x27: 00000085f19dc08d x26: 0000000000000000 [ 575.356681] x25: ffff8000144e3ba0 x24: ffff800011fdf038 [ 575.361991] x23: ffff8000144e3d20 x22: 0000000000000001 [ 575.367301] x21: ffff800011fdf000 x20: ffff0009609d4740 [ 575.372611] x19: 0000000000000000 x18: 0000000000000000 [ 575.377921] x17: 0000000000000000 x16: 0000000000000000 [ 575.383231] x15: 0000000000000000 x14: 0000000000000000 [ 575.388540] x13: 0000000000000000 x12: 0000000000000000 [ 575.393850] x11: 0000000000000000 x10: ffff8000000bc65c [ 575.399160] x9 : 0000000000000000 x8 : ffff8000144e3c58 [ 575.404469] x7 : 0000000000000000 x6 : 0000000dd7ae967a [ 575.409779] x5 : 00ffffffffffffff x4 : 0007fabd6992cf96 [ 575.415088] x3 : 0000000000000018 x2 : ffff8000000ba214 [ 575.420398] x1 : 000000000000000a x0 : 0000000000000009 [ 575.425708] Call trace: [ 575.428152] bpf_prog_64e6f4ba80861823_F+0x2e4/0x9a4 [ 575.433114] bpf_prog_d3e125b76c96daac+0x40/0xdec [ 575.437822] bpf_dispatcher_xdp_func+0x10/0x1c [ 575.442265] bpf_test_run+0x80/0x240 [ 575.445838] bpf_prog_test_run_xdp+0xe8/0x190 [ 575.450196] __do_sys_bpf+0x8e8/0x1b00 [ 575.453943] __arm64_sys_bpf+0x24/0x510 [ 575.457780] el0_svc_common.constprop.0+0x6c/0x170 [ 575.462570] do_el0_svc+0x24/0x90 [ 575.465883] el0_sync_handler+0x90/0x19c [ 575.469802] el0_sync+0x158/0x180 [ 575.473118] Code: d4202000 d4202000 d4202000 d4202000 (d4202000) [ 575.479211] ---[ end trace 8cd54c7d5c0ffda4 ]--- Cheers /Ilias _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel