From: Edward Cree Subject: Re: [PATCH bpf-next 4/4] bpf: add self-check logic to liveness analysis Date: Thu, 13 Dec 2018 20:02:09 +0000 Message-ID: <73aafbef-e470-cf87-4956-ae4207ae583f@solarflare.com> References: <20181212052854.4105971-1-ast@kernel.org> <20181212052854.4105971-5-ast@kernel.org> <896e6645-b8fd-b069-2d78-b219a97e6273@solarflare.com> <20181212220029.b3blnqrirdt2unzr@ast-mbp.dhcp.thefacebook.com> <20181213000054.dlpzdwtdos3ob4zq@ast-mbp.dhcp.thefacebook.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Cc: Alexei Starovoitov , "David S . Miller" , , , , , To: Alexei Starovoitov Return-path: Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.164]:58358 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbeLMUCS (ORCPT ); Thu, 13 Dec 2018 15:02:18 -0500 In-Reply-To: <20181213000054.dlpzdwtdos3ob4zq@ast-mbp.dhcp.thefacebook.com> Content-Language: en-GB Sender: netdev-owner@vger.kernel.org List-ID: On 13/12/18 00:00, Alexei Starovoitov wrote: > luckily found it in my email archives. next time could you send a link to > make sure we're talking about the same patch? Sorry, will do. > back then there was no per-register chains and push_stack() > has to do only one live_children++. > With per-register it would need to walk all frames and all regs and > all stack slots. Thinking about it, since this is about control flow rather than data flow,  maybe it makes sense to add in a separate parent pointer on the verifier  state, and use that for this, rather than shoehorning it into the  liveness machinery. > Old kill_thread() instead of: > + while (cur && !--cur->live_children) > + cur = cur->parent; > becomes such inner loop for all frames, all regs and all slots, right? If it's done with the per-reg parent pointers, then yes that's right and  that does start to look a bit painful, agreed. > As far as state merging I see a pattern when a bunch of states are > overlapping in the register ranges, but not fully contained. > Essentially range_within() is too conservative. > The idea is to merge [1,5] with [3,10] if this is the only difference > between states. Merge, but don't declare it safe yet and proceed further. Yep, makes sense. -Ed