From: David Miller Subject: Re: [PATCH net] net, sched: fix panic when updating miniq {b,q}stats Date: Tue, 16 Jan 2018 15:03:46 -0500 (EST) Message-ID: <20180116.150346.1844547653220225428.davem@davemloft.net> References: <20180115221209.22360-1-daniel@iogearbox.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, sandipan@linux.vnet.ibm.com, bhole_prashant_q7@lab.ntt.co.jp, john.fastabend@gmail.com, ast@kernel.org, jiri@resnulli.us To: daniel@iogearbox.net Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:59276 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbeAPUDs (ORCPT ); Tue, 16 Jan 2018 15:03:48 -0500 In-Reply-To: <20180115221209.22360-1-daniel@iogearbox.net> Sender: netdev-owner@vger.kernel.org List-ID: From: Daniel Borkmann Date: Mon, 15 Jan 2018 23:12:09 +0100 > While working on fixing another bug, I ran into the following panic > on arm64 by simply attaching clsact qdisc, adding a filter and running > traffic on ingress to it: ... > Reason is that sch_ingress and sch_clsact are doing mini_qdisc_pair_init() > which sets up miniq pointers to cpu_{b,q}stats from the underlying qdisc. > Problem is that this cannot work since they are actually set up right after > the qdisc ->init() callback in qdisc_create(), so first packet going into > sch_handle_ingress() tries to call mini_qdisc_bstats_cpu_update() and we > therefore panic. > > In order to fix this, allocation of {b,q}stats needs to happen before we > call into ->init(). In net-next, there's already such option through commit > d59f5ffa59d8 ("net: sched: a dflt qdisc may be used with per cpu stats"). > However, the bug needs to be fixed in net still for 4.15. Thus, include > these bits to reduce any merge churn and reuse the static_flags field to > set TCQ_F_CPUSTATS, and remove the allocation from qdisc_create() since > there is no other user left. Prashant Bhole ran into the same issue but > for net-next, thus adding him below as well as co-author. Same issue was > also reported by Sandipan Das when using bcc. > > Fixes: 46209401f8f6 ("net: core: introduce mini_Qdisc and eliminate usage of tp->q for clsact fastpath") > Reference: https://lists.iovisor.org/pipermail/iovisor-dev/2018-January/001190.html > Reported-by: Sandipan Das > Co-authored-by: Prashant Bhole > Co-authored-by: John Fastabend > Signed-off-by: Daniel Borkmann Applied, thanks Daniel.