Received: by 10.223.164.221 with SMTP id h29csp2443495wrb; Thu, 2 Nov 2017 11:00:54 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QchfsHNG6YLpyeOp95U/gJ0NN9cP4pdxZp+nlt30vnHmczWaCkVBITFb79sy1SvMLvYptC X-Received: by 10.98.156.207 with SMTP id u76mr4689588pfk.211.1509645654544; Thu, 02 Nov 2017 11:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509645654; cv=none; d=google.com; s=arc-20160816; b=vmHCT2Qdu8dsB8SVZbt9aZ6Cwnsj4h6pgIvRgB4rM4NbgBXKFXliRW+Bxo5IszzhRg BpH4s9CHxSy3/LPtZMt52GP5FdJ53xhLeI7Ptq6bWGSLsa3zoa2uj3Evtx9z+/uwZoHX M3Rm9PkUcX36t+prJHy76m+f3PuzNn251fOpXWwpuZefsHSyDGoHvsmZWNHWodij0ogi e3itECi228VUIns00kEAEa41fWJnd3LtL9HkhM31kHSTZtFSNxcey4ym680Ssh0vfCrk kwTHIAsbUez53zFaDOUiS5Edu2X0k4/txp4bEgGME17eRN6AmFR5PeEIb8+DUsjfgesT AviA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=15lBi8n9oIFWqJqVoy3jVEC6YY2/BGbuLgxGb5YVI04=; b=ugxhFWhv6HXxFv/r9+awczsRlrU7mYE+ZL9LOI1IblyeBSN4vBjomU0r3mtC2aULiV cznEr99YVyX8tX1sZNmjqOHoxcqNNQCuY7MYFO3RX0Y8+bJLJdADHGQgHiJf3Azc61wR y/xFCgA4B71BGipKES3gcGZbhE3OJAt+odxVrJ6kkGfelMGRXS19sI028UoYIhj4C8Lb ieZx/ADS2i+ZjfFbRW/nU7i1moDXGIKbzOxtdEwrQwdCeFa6KJ85mt//RdRR4jnZ9/Kt Mvm0AXG8DOFeiq8y2oX+5AikcyqVOzmqmHNVWUbwvr6cWxVXu5X91h38Y1X2Bi3eNj74 oLEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=L++LRWsO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s89si4386755pfk.96.2017.11.02.11.00.39; Thu, 02 Nov 2017 11:00:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=L++LRWsO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933436AbdKBR6x (ORCPT + 97 others); Thu, 2 Nov 2017 13:58:53 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:43295 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932383AbdKBR6u (ORCPT ); Thu, 2 Nov 2017 13:58:50 -0400 Received: by mail-qt0-f194.google.com with SMTP id j58so449857qtj.0 for ; Thu, 02 Nov 2017 10:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=15lBi8n9oIFWqJqVoy3jVEC6YY2/BGbuLgxGb5YVI04=; b=L++LRWsOsLZh9BCta1yyKGYAgs+yyEp503JOg+C7vVyu8m1Pmb2uGS3/YFn/BBlV92 YTDJiMGuIP2Si7cBep43Y+IqAXA4MZmmFdne9YMHsV8h89zGzqt3Aw681SwyeJpTM1v1 u/ylyUbPkR9LFV+w4XW275jJA48qf1DnJ1Q8ZftsZISmlZ8BAkK1Sd1es5CmL/KB3UV9 p20UGjqiuiFDMHehp7VlRexFu0to9Ypa9z2UjmyucUom/09GwwesvdEY96X7Lb6iAcwD pLq/kc2c7cGitAS/slciSGJt3DWhQhHVgBKA2ulx9OcUByMcJwbbFq//E+i5l2U/o1YX 1zHg== 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:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=15lBi8n9oIFWqJqVoy3jVEC6YY2/BGbuLgxGb5YVI04=; b=gjUCCh3IxKH2EfqIKBSV+JwdGUQhdCqubPLtDh38ktR4mWh4lnhJeGWANLd164yIBA w7R++y22kT8AUtgG88RTi81W3p741z2rwDcU8/A1X012jAOo7KNdA4FPpIJYykB8+VJS h2P7Wp61w4wqcvc5kzoJSHlR6Q9CsplEX35CVZIcbA6rh772rELYI2/ptd7T9KbxhpLn JfFEqMgijavSmTGUM9pm/jOKF4i2Rn1M3q5sKRSkGOq4IwgyH8kEy4GUYeagzC304xhf AcDSTDZcmordgVd9cLRLfpDHNJlIer6NY2essGhBnW+mQH4gyxImnj7aUW3U4GNSUEsy k8tA== X-Gm-Message-State: AJaThX5wOKoJim1joiS4aDool7EWQkUTrm+5xpBfSErljjPeLpjhVIFu Dp+Dnded2j8GiWmfcCPMvIPvRZXm X-Received: by 10.237.62.252 with SMTP id o57mr6150767qtf.144.1509645530317; Thu, 02 Nov 2017 10:58:50 -0700 (PDT) Received: from cakuba.netronome.com ([75.53.12.129]) by smtp.gmail.com with ESMTPSA id k7sm2383191qkf.45.2017.11.02.10.58.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2017 10:58:50 -0700 (PDT) Date: Thu, 2 Nov 2017 10:58:46 -0700 From: Jakub Kicinski To: Arnd Bergmann Cc: Alexei Starovoitov , Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , Edward Cree , John Fastabend , Networking , Linux Kernel Mailing List Subject: Re: [PATCH 2/2] [net-next] bpf: fix out-of-bounds access warning in bpf_check Message-ID: <20171102105846.2609f1ec@cakuba.netronome.com> In-Reply-To: References: <20171102110558.2746221-1-arnd@arndb.de> <20171102110558.2746221-2-arnd@arndb.de> <20171102155945.vvrrugvhrgdvvkso@ast-mbp> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Nov 2017 17:14:00 +0100, Arnd Bergmann wrote: > On Thu, Nov 2, 2017 at 4:59 PM, Alexei Starovoitov wrote: > > On Thu, Nov 02, 2017 at 12:05:52PM +0100, Arnd Bergmann wrote: > >> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > >> index 750aff880ecb..debb60ad08ee 100644 > >> --- a/kernel/bpf/verifier.c > >> +++ b/kernel/bpf/verifier.c > >> @@ -4447,6 +4447,10 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr) > >> struct bpf_verifer_log *log; > >> int ret = -EINVAL; > >> > >> + /* no program is valid */ > >> + if (ARRAY_SIZE(bpf_verifier_ops) == 0) > >> + return -EINVAL; > > > > sorry I don't see how bpf_verifier_ops can be empty. > > Did you mix it up with your previous patch when you made bpf_analyzer_ops empty? > > I confused the two a couple of times while creating the patches, but > I'm still fairly > sure I got it right in the end: > > bpf_verifier_ops is an array that gets generated by including linux/bpf_types.h. > That file has two kinds of entries: > > - BPF_MAP_TYPE() entries are left out, as that macro is defined to an > empty string > here. > > - BPF_PROG_TYPE() entries are conditional depending on CONFIG_NET and > CONFIG_BPF_EVENTS. In the configuration that produces the warning, > both are disabled. Right. My preferred fix was to add a NULL entry to the table so it's never empty, but this is OK too. Thanks! From 1582971529989026708@xxx Thu Nov 02 16:14:51 +0000 2017 X-GM-THRID: 1582952280708618442 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread