From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
Edward Cree <ecree@solarflare.com>,
John Fastabend <john.fastabend@gmail.com>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
Networking <netdev@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] [net-next] bpf: fix out-of-bounds access warning in bpf_check
Date: Thu, 2 Nov 2017 11:47:01 -0700 [thread overview]
Message-ID: <20171102184659.a2mtsr354dy22znn@ast-mbp> (raw)
In-Reply-To: <CAK8P3a3iRUCCbhXfRsRY4=_QUKGN7=cVaKgcOgLMAn22v-TRow@mail.gmail.com>
On Thu, Nov 02, 2017 at 05:14:00PM +0100, Arnd Bergmann wrote:
> On Thu, Nov 2, 2017 at 4:59 PM, Alexei Starovoitov
> <alexei.starovoitov@gmail.com> 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.
I see. Didn't realize that it's possible to enable bpf syscall
without networking and tracing support.
I'm thinking whether it's better to disallow such uselss mode in kconfig,
but it's probably going to be convoluted.
Above if (ARRAY_SIZE(bpf_verifier_ops) == 0) will be optimized away
by gcc in 99.9% of configs, so I guess that's fine, so:
Acked-by: Alexei Starovoitov <ast@kernel.org>
next prev parent reply other threads:[~2017-11-02 18:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-02 11:05 [PATCH 1/2] [net-next] bpf: fix link error without CONFIG_NET Arnd Bergmann
2017-11-02 11:05 ` [PATCH 2/2] [net-next] bpf: fix out-of-bounds access warning in bpf_check Arnd Bergmann
2017-11-02 15:59 ` Alexei Starovoitov
2017-11-02 16:14 ` Arnd Bergmann
2017-11-02 17:58 ` Jakub Kicinski
2017-11-02 18:47 ` Alexei Starovoitov [this message]
2017-11-02 22:35 ` Daniel Borkmann
2017-11-03 5:20 ` David Miller
2017-11-02 17:55 ` [PATCH 1/2] [net-next] bpf: fix link error without CONFIG_NET Jakub Kicinski
2017-11-02 18:48 ` Alexei Starovoitov
2017-11-02 22:32 ` Daniel Borkmann
2017-11-03 5:20 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171102184659.a2mtsr354dy22znn@ast-mbp \
--to=alexei.starovoitov@gmail.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ecree@solarflare.com \
--cc=jakub.kicinski@netronome.com \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®