From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [PATCH 2/2] [net-next] bpf: fix out-of-bounds access warning in bpf_check Date: Thu, 02 Nov 2017 23:35:22 +0100 Message-ID: <59FB9DAA.702@iogearbox.net> References: <20171102110558.2746221-1-arnd@arndb.de> <20171102110558.2746221-2-arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: "David S. Miller" , Edward Cree , John Fastabend , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: Arnd Bergmann , Alexei Starovoitov Return-path: In-Reply-To: <20171102110558.2746221-2-arnd@arndb.de> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 11/02/2017 12:05 PM, Arnd Bergmann wrote: > The bpf_verifer_ops array is generated dynamically and may be > empty depending on configuration, which then causes an out > of bounds access: > > kernel/bpf/verifier.c: In function 'bpf_check': > kernel/bpf/verifier.c:4320:29: error: array subscript is above array bounds [-Werror=array-bounds] > > This adds a check to the start of the function as a workaround. > I would assume that the function is never called in that configuration, > so the warning is probably harmless. > > Fixes: 00176a34d9e2 ("bpf: remove the verifier ops from program structure") > Signed-off-by: Arnd Bergmann Acked-by: Daniel Borkmann LGTM, and bpf_analyzer() already has proper logic to bail out for such cases (although only used by nfp right now, which is there when NET is configured anyway).