From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH 2/7] mark root hnode explicitly Date: Fri, 7 Sep 2018 04:49:58 +0100 Message-ID: <20180907034958.GZ19965@ZenIV.linux.org.uk> References: <20180905190134.GQ19965@ZenIV.linux.org.uk> <20180905190414.5477-1-viro@ZenIV.linux.org.uk> <20180905190414.5477-2-viro@ZenIV.linux.org.uk> <8d3e140a-eb1b-3aae-d9e7-36d103a54e5e@mojatatu.com> <5689c19a-c4fb-24c1-4594-86f2639faa98@mojatatu.com> <20180906105933.GU19965@ZenIV.linux.org.uk> <20180907030438.GX19965@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jamal Hadi Salim , Linux Kernel Network Developers , Jiri Pirko To: Cong Wang Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:45712 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725931AbeIGI24 (ORCPT ); Fri, 7 Sep 2018 04:28:56 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Thu, Sep 06, 2018 at 08:23:36PM -0700, Cong Wang wrote: > Pretty sure there is a 'tp' in u32_set_parms() parameter list. > > Are you saying it is not what you want? If so, why? > > More importantly, why this information is again missing in your > changelog? This patch is definitely not trivial, it deserves a detailed > changelog. > > > > our own root, sure. But there's nothing to stop doing the same via another > > tcf_proto... > > To my best knowledge, the place where you set ->is_root=true > is precisely same with where we set tp->root=root_ht, and it doesn't > change after set. What am I missing here? The fact that there can be two (or more) different tcf_proto instances sharing ->data, but not ->root. And since ->data is shared, u32_get() on one tp will be able to return you ->root of *ANOTHER* one. So comparison with tp->root doesn't protect you. Try this on mainline: tc qdisc add dev eth0 ingress tc filter add dev eth0 parent ffff: protocol ip prio 100 handle 1: u32 divisor 1 tc filter add dev eth0 parent ffff: protocol ip prio 200 handle 2: u32 divisor 1 tc filter delete dev eth0 parent ffff: protocol ip prio 100 handle 801: u32 and watch the fun as soon as you get an incoming packet on eth0. That panic is fixed by 1/7, but you get "Not allowed to delete root node" for removing _your_ root, with "Can not delete in-use filter" for other's root (as in the last line of the reproducer).