[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 12 Dec 2018 22:26:17 +0000
From: Edward Cree <ecree@...arflare.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
CC: Alexei Starovoitov <ast@...nel.org>,
"David S . Miller" <davem@...emloft.net>, <daniel@...earbox.net>,
<jakub.kicinski@...ronome.com>, <jiong.wang@...ronome.com>,
<netdev@...r.kernel.org>, <kernel-team@...com>
Subject: Re: [PATCH bpf-next 4/4] bpf: add self-check logic to liveness
analysis
On 12/12/18 22:00, Alexei Starovoitov wrote:
> On Wed, Dec 12, 2018 at 08:58:33PM +0000, Edward Cree wrote:
>> A different way I previously thought of was to have a refcount in
>> verifier states (at the time we had a single parent rather than per-
>> register parents) counting live children, that falls to 0 when all
>> continuations have been walked. That was something I did in my
>> bounded loops RFC.
>> With something like that, we could check refcount != 0 in mark_reg_read
>> and check refcount == 0 in explored states in is_state_visited. Seems
>> to me like that gets you the same thing and also adds the guarantee
>> that our explored_states really are fully explored.
> refcnt was my initial approach, but it needs to walk parentage chain.
> Also push/pop_stack needs full walk of all chains too.
> That is too expensive.
> What kind of refcnt you had in mind?
Shallow, rather than deep, refcnt means that you only have to walk to the
parent when your refcnt falls to zero. push_stack never has to walk at
all. The refcnt only counts immediate children, not all descendants.
IIRC that's how I implemented it in my bounded loops RFC; see patch #9
"bpf/verifier: count still-live children of explored_states" of that
series.
Maybe it would still be too expensive, but I wonder if we should obtain
numbers for that rather than guessing that it would or wouldn't. Note
that if a process_bpf_exit would walk N states dropping refs, then there
are N states that would need to be marked DONE by your approach; and you
re-do clean_live_states() for each one every time is_state_visited()
comes back to the same insn, rather than just walking them once on exit.
>> Rest of series looks good, have my Ack for patches 1-3.
>> (Though, maybe use a few more capital letters in your commit messages?)
> Meaning capitalize first letter of the sentences?
Yes, that was what I meant. (Also I think patch #2 is missing a full
stop at the end of the sentence, but now I'm just being picky ;-)
-Ed
Powered by blists - more mailing lists