[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e84ec4b3-ea21-a2ed-d6fb-1c899ef748d0@fb.com>
Date: Wed, 20 Mar 2019 23:31:54 +0000
From: Yonghong Song <yhs@...com>
To: Paul Chaignon <paul.chaignon@...nge.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>
CC: "xiao.han@...nge.com" <xiao.han@...nge.com>,
"paul.chaignon@...il.com" <paul.chaignon@...il.com>,
Martin Lau <kafai@...com>, Song Liu <songliubraving@...com>
Subject: Re: [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning
On 3/20/19 5:57 AM, Paul Chaignon wrote:
> The BPF verifier checks the maximum number of call stack frames twice,
> first in the main CFG traversal (do_check) and then in a subsequent
> traversal (check_max_stack_depth). If the second check fails, it logs a
> 'verifier bug' warning and errors out, as the number of call stack frames
> should have been verified already.
>
> However, the second check may fail without indicating a verifier bug: if
> the excessive function calls reside in dead code, the main CFG traversal
> may not visit them; the subsequent traversal visits all instructions,
> including dead code.
>
> This case raises the question of how invalid dead code should be treated.
Maybe we should do this check after dead code elimination to be
consistent with do_check? There could some other kinds of illegal stuff
in the dead code, e.g., illegal/unsupported helpers, etc. I suppose we
did not warn or reject the program, right?
> The first patch implements the conservative option and rejects such code;
> the second adds a test case.
>
> Paul Chaignon (2):
> bpf: remove incorrect 'verifier bug' warning
> selftests/bpf: test case for invalid call stack in dead code
>
> kernel/bpf/verifier.c | 5 +--
> tools/testing/selftests/bpf/verifier/calls.c | 38 ++++++++++++++++++++
> 2 files changed, 41 insertions(+), 2 deletions(-)
>
Powered by blists - more mailing lists