Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2554770rdb; Tue, 12 Sep 2023 05:48:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHXdXnzrlFBLeh8cUigw/1yzRDmApd3pga87QzxRY6snqU0mIUJgZ/rVUm1mITwDNs4pIT X-Received: by 2002:a05:6a00:1951:b0:68e:23c9:b306 with SMTP id s17-20020a056a00195100b0068e23c9b306mr13684615pfk.30.1694522890216; Tue, 12 Sep 2023 05:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694522890; cv=none; d=google.com; s=arc-20160816; b=Ezs4FojzenV1npYK2QxoD2ojZRRYqjbGoOIZCbaQNtuKwresuPjS46XrbGxywXdf81 sSEp/DC6Ln/py553M07VUoW+VIkF0dVXpPQ9HTaBhOjzTiqLZ0rRnbaNTVir5XCatiXA Rw6HDdYY6bzoHdhfZHgPmOjmOKuwufhHM7iiGALFMbd5PA6W6PVfSQRqxMc2/dwSCvCM C0IoLnfpjuyOY/Pa0CPmg6BQWFw0D0Q+0qYBnB8d0clcWY2CK494UVEhtxCgCIa7KdZE O7SzI1VcN0l5/fCgombRx7SZbIZSc9MSq+qyoIpGR5yEqkUGrK8yE4fxLyAEdZrb+IvQ MP8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ZsZy2iIh2zDg00qiSjHtnW/ykAGffE6l+6FjzwMusCo=; fh=Lbws4gdd2pBkkQ+xXf1Ikm4CFQSefoRGApd0KFa+4og=; b=yFvAD2+1Ol+l1+DgrcN/t5ZJ7jE76u374R+KvH9Nsz0Rf8SovDj8HrAqH5Zxxe+/Kw g/q6Mfr0ciawrWiJ9FbuvyPP08BSJMqK/EHoM2BlQzy4bC96Qja7I4EkkOCxcCYtpzb8 AMp+y3MuA+9XRBhJuCpktgqRMvFdfBjC6u2tSvHOl3hwNXT3IqM5DnjG6hDoFI66FxgE qJ80xzJuLIY8+J+ehCvXzO/I5XzFyudN0vhdAVTs45h1TdE6p/dbteQVxcS1ZDbIKgWp 1ZBk5ej2ZOMmD0fz4J2XRM/J2DM48ytvP5rXPH7shl5/RcJCkRdFp1TcOD+vzcaPUM0x 42Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y64-20020a638a43000000b0057761dd9c56si4546897pgd.322.2023.09.12.05.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 05:48:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D4DCB80D6AFD; Tue, 12 Sep 2023 05:00:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235075AbjILMAB (ORCPT + 99 others); Tue, 12 Sep 2023 08:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235069AbjILL7O (ORCPT ); Tue, 12 Sep 2023 07:59:14 -0400 Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D655E1717; Tue, 12 Sep 2023 04:58:27 -0700 (PDT) Received: from [46.6.227.206] (port=6296 helo=gnumonks.org) by ganesha.gnumonks.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qg224-00CtNF-Px; Tue, 12 Sep 2023 13:58:23 +0200 Date: Tue, 12 Sep 2023 13:58:13 +0200 From: Pablo Neira Ayuso To: Timo Sigurdsson Cc: kadlec@netfilter.org, fw@strlen.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, regressions@lists.linux.dev, sashal@kernel.org, carnil@debian.org, 1051592@bugs.debian.org Subject: Re: Regression: Commit "netfilter: nf_tables: disallow rule addition to bound chain via NFTA_RULE_CHAIN_ID" breaks ruleset loading in linux-stable Message-ID: References: <20230911213750.5B4B663206F5@dd20004.kasserver.com> <20230912113959.8F8B26321005@dd20004.kasserver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230912113959.8F8B26321005@dd20004.kasserver.com> X-Spam-Score: -1.9 (-) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Sep 2023 05:00:44 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email On Tue, Sep 12, 2023 at 01:39:59PM +0200, Timo Sigurdsson wrote: > Hi Pablo, > > Pablo Neira Ayuso schrieb am 12.09.2023 00:57 (GMT +02:00): > > > Hi Timo, > > > > On Mon, Sep 11, 2023 at 11:37:50PM +0200, Timo Sigurdsson wrote: > >> Hi, > >> > >> recently, Debian updated their stable kernel from 6.1.38 to 6.1.52 > >> which broke nftables ruleset loading on one of my machines with lots > >> of "Operation not supported" errors. I've reported this to the > >> Debian project (see link below) and Salvatore Bonaccorso and I > >> identified "netfilter: nf_tables: disallow rule addition to bound > >> chain via NFTA_RULE_CHAIN_ID" (0ebc1064e487) as the offending commit > >> that introduced the regression. Salvatore also found that this issue > >> affects the 5.10 stable tree as well (observed in 5.10.191), but he > >> cannot reproduce it on 6.4.13 and 6.5.2. > >> > >> The issue only occurs with some rulesets. While I can't trigger it > >> with simple/minimal rulesets that I use on some machines, it does > >> occur with a more complex ruleset that has been in use for months > >> (if not years, for large parts of it). I'm attaching a somewhat > >> stripped down version of the ruleset from the machine I originally > >> observed this issue on. It's still not a small or simple ruleset, > >> but I'll try to reduce it further when I have more time. > >> > >> The error messages shown when trying to load the ruleset don't seem > >> to be helpful. Just two simple examples: Just to give two simple > >> examples from the log when nftables fails to start: > >> /etc/nftables.conf:99:4-44: Error: Could not process rule: Operation not > >> supported > >> tcp option maxseg size 1-500 counter drop > >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >> /etc/nftables.conf:308:4-27: Error: Could not process rule: Operation not > >> supported > >> tcp dport sip-tls accept > >> ^^^^^^^^^^^^^^^^^^^^^^^^ > > > > I can reproduce this issue with 5.10.191 and 6.1.52 and nftables v1.0.6, > > this is not reproducible with v1.0.7 and v1.0.8. > > > >> Since the issue only affects some stable trees, Salvatore thought it > >> might be an incomplete backport that causes this. > >> > >> If you need further information, please let me know. > > > > Userspace nftables v1.0.6 generates incorrect bytecode that hits a new > > kernel check that rejects adding rules to bound chains. The incorrect > > bytecode adds the chain binding, attach it to the rule and it adds the > > rules to the chain binding. I have cherry-picked these three patches > > for nftables v1.0.6 userspace and your ruleset restores fine. > > hmm, that doesn't explain why Salvatore didn't observe this with > more recent kernels. > > Salvatore, did you use newer userspace components when you tested > your 6.4.13 and 6.5.2 builds? > > As for the regression and how it be dealt with: Personally, I don't > really care whether the regression is solved in the kernel or > userspace. If everybody agrees that this is the best or only viable > option and Debian decides to push a nftables update to fix this, > that works for me. But I do feel the burden to justify this should > be high. A kernel change that leaves users without a working packet > filter after upgrading their machines is serious, if you ask me. And > since it affects several stable/longterm trees, I would assume this > will hit other stable (non-rolling) distributions as well, since > they will also use older userspace components (unless this is > behavior specific to nftables 1.0.6 but not older versions). They > probably should get a heads up then. There is coverage for the chain binding feature in our tests infrastructure, but unfortunately the bug did not trigger with newer nftables versions. In the future, I will keep an eye with running our tests on older userspace nftables versions when working on stable trees.