Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2191138pxk; Mon, 14 Sep 2020 07:06:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2vursUj7RlbrVpbs8kl1apsiLVz2omK7MK+XFrgcxEBxlPooTu/IjSu2Tl5AqMSDHdiee X-Received: by 2002:a17:906:c0c4:: with SMTP id bn4mr6929007ejb.27.1600092382511; Mon, 14 Sep 2020 07:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600092382; cv=none; d=google.com; s=arc-20160816; b=rBpMiQA1aBM0MfEV1rwjNAvYVnWdsuE0Bg31P0mNO9wac7F9BvIfVnscgFon+fUvTB CptV1nyOtqJbNV5Z9UxuML8aXFC4G6m/4eqFawFDYks4Y4fWMX2Jev/yjNTOizz+8rhR AnlEGBEupKi8VdofQq+oUiOQuF79N6ULCxGTd1UW5z7EV34qxS7uGJQbO3Jdva+x8fMq 1QcNUS2wpU1BEZnR1YL4yh3n/oUwPUAp+4fOjwWGzBddP3CmTb0FU+Ag9lvtd/dKZsO+ foyC9jN2+aF7Bj46toFnCWauAw/2Qp+PPa8CIKCQhzjtKyL/EAWrp9qqjAERAEb5VOMC Cjsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rFW0MlA1UWrqWOhs4GjB783nRG7pu/huiI/i5wyluvY=; b=xJXjW7fKIco5laou+CrZwV9n6vj0u5xResy5C+GY4GVRiR+724bHrmFFyGGPdZRRhY H5ty8je/zM0Fw5KHWu1UT1E1FnJkem5onhciZpfuHUvA3ifhP/1iGRLZ+lkjEjMg6v9e UmOi2zSD/gXHs+K0hdfiQHi3zr92KMk69ZXBdiV0L2HcjHMbL8XRrYXBqA3mgYpn4ewK lrBXuanLSdfuNUrriQ1pJHvq8MI9SOvrRtwoHx7y9yHnjWpO3NrOTDS1a+GS0ZlZDnQp ltabFi+Gde7XvbqfgcXBbxxUmEPLMRgPgf6hoUqFZNeIzb/lfVGcTGie4idmEjYJPMms 0kFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zJsZJ6zE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ot3si7004366ejb.103.2020.09.14.07.06.00; Mon, 14 Sep 2020 07:06:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zJsZJ6zE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726402AbgINOEn (ORCPT + 99 others); Mon, 14 Sep 2020 10:04:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbgINOBk (ORCPT ); Mon, 14 Sep 2020 10:01:40 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6067F208E4; Mon, 14 Sep 2020 14:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600092082; bh=uGQUvm/OYFR2K5MLndS6fIko6WhVxVx+Wnfq37H7WNc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zJsZJ6zERMaYi/aOqwTDzLwuLhhOZnp5WvoE2wKtKMJQgLJMF7HJi+fkdeVbEpyMq H2dogMKvpig6YxNQG5PjAwCStQoOiroxn6sObHK2aLPYfaVnzBACDPH08T2RMvs65R MsK8VkAriperAXNqG0t3OjqACEuTzDnVNHOLF0s4= Date: Mon, 14 Sep 2020 15:01:15 +0100 From: Will Deacon To: Ilias Apalodimas Cc: bpf@vger.kernel.org, ardb@kernel.org, naresh.kamboju@linaro.org, Jean-Philippe Brucker , Yauheni Kaliuta , Daniel Borkmann , Alexei Starovoitov , Zi Shen Lim , Catalin Marinas , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: bpf: Fix branch offset in JIT Message-ID: <20200914140114.GG24441@willie-the-truck> References: <20200914083622.116554-1-ilias.apalodimas@linaro.org> <20200914122042.GA24441@willie-the-truck> <20200914123504.GA124316@apalos.home> <20200914132350.GA126552@apalos.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914132350.GA126552@apalos.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ilias, On Mon, Sep 14, 2020 at 04:23:50PM +0300, Ilias Apalodimas wrote: > On Mon, Sep 14, 2020 at 03:35:04PM +0300, Ilias Apalodimas wrote: > > On Mon, Sep 14, 2020 at 01:20:43PM +0100, Will Deacon wrote: > > > On Mon, Sep 14, 2020 at 11:36:21AM +0300, Ilias Apalodimas wrote: > > > > Running the eBPF test_verifier leads to random errors looking like this: [...] > > > > The reason seems to be the offset[] creation and usage ctx->offset[] > > > > > > "seems to be"? Are you unsure? > > > > Reading the history and other ports of the JIT implementation, I couldn't > > tell if the decision on skipping the 1st entry was deliberate or not on > > Aarch64. Reading through the mailist list didn't help either [1]. > > Skipping the 1st entry seems indeed to cause the problem. > > I did run the patch though the BPF tests and showed no regressions + fixing > > the error. > > I'll correct myself here. > Looking into 7c2e988f400e ("bpf: fix x64 JIT code generation for jmp to 1st insn") > explains things a bit better. > Jumping back to the 1st insn wasn't allowed until eBPF bounded loops were > introduced. That's what the 1st instruction was not saved in the original code. > > > > > > > No Fixes: tag? > > > > I'll re-spin and apply one > > > Any suggestion on any Fixes I should apply? The original code was 'correct' and > broke only when bounded loops and their self-tests were introduced. Ouch, that's pretty bad as it means nobody is regression testing BPF on arm64 with mainline. Damn. The Fixes: tag should identify the commit beyond which we don't need to backport the fix, so it sounds like introduction of bounded loops, according to your analysis. Will