From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FE2FC46479 for ; Tue, 11 Jun 2019 15:29:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 354AA2080A for ; Tue, 11 Jun 2019 15:29:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404803AbfFKP3w (ORCPT ); Tue, 11 Jun 2019 11:29:52 -0400 Received: from Chamillionaire.breakpoint.cc ([193.142.43.52]:42586 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387864AbfFKP3w (ORCPT ); Tue, 11 Jun 2019 11:29:52 -0400 X-Greylist: delayed 1607 seconds by postgrey-1.27 at vger.kernel.org; Tue, 11 Jun 2019 11:29:51 EDT Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.89) (envelope-from ) id 1haiIg-00066R-Rk; Tue, 11 Jun 2019 17:03:02 +0200 Date: Tue, 11 Jun 2019 17:03:02 +0200 From: Florian Westphal To: John Hurley Cc: Florian Westphal , David Miller , Linux Netdev List , Simon Horman , Jakub Kicinski , Jamal Hadi Salim , oss-drivers@netronome.com Subject: Re: [RFC net-next v2 1/1] net: sched: protect against loops in TC filter hooks Message-ID: <20190611150302.smeuvloq7vvtcccp@breakpoint.cc> References: <1559825374-32117-1-git-send-email-john.hurley@netronome.com> <20190606125818.bvo5im2wqj365tai@breakpoint.cc> <20190606.111954.2036000288766363267.davem@davemloft.net> <20190606195255.4uelltuxptwobhiv@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org John Hurley wrote: > On Thu, Jun 6, 2019 at 8:52 PM Florian Westphal wrote: > > > > David Miller wrote: > > > From: Florian Westphal > > > Date: Thu, 6 Jun 2019 14:58:18 +0200 > > > > > > >> @@ -827,6 +828,7 @@ struct sk_buff { > > > >> __u8 tc_at_ingress:1; > > > >> __u8 tc_redirected:1; > > > >> __u8 tc_from_ingress:1; > > > >> + __u8 tc_hop_count:2; > > > > > > > > I dislike this, why can't we just use a pcpu counter? > > > > > > I understand that it's because the only precise context is per-SKB not > > > per-cpu doing packet processing. This has been discussed before. > > > > I don't think its worth it, and it won't work with physical-world > > loops (e.g. a bridge setup with no spanning tree and a closed loop). > > > > Also I fear that if we start to do this for tc, we will also have to > > followup later with more l2 hopcounts for other users, e.g. veth, > > bridge, ovs, and so on. > > Hi David/Florian, > Moving forward with this, should we treat the looping and recursion as > 2 separate issues and at least prevent the potential stack overflow > panics caused by the recursion? > The pcpu counter should protect against this. As outlined above, I think they are different issues. > Are there context specific issues that we may miss by doing this? I can't think of any. > If not I will respin with the pcpu counter in act_mirred. Sounds good to me, thanks.