From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796319246; b=CP5VB4t84rJYVzb3bMLEMF9qmeupR8LfqxbjYs7rebOQRPE2aft4c9MBjhX6yCYLhVcs 7mwTJlU3SnHKW4YNE5AbQ2y0MdeWF7fcrYtkVjhVG1tHKm+VPSx5SaLTNaErhadn2sp3y LHza4HRJwO4qSeVx1UqDnpy4kd4+zA3YioVlAcOFJ5eaoqMQF0IJnTHSbJfBmuBg1M4Fn LpmJMTIWPm8HMLuXPXOf7T6/FTP2ENz7XGiNIa6C62sZCGkL62Rpa4AE8y7gfjJ8x7gat uA/cR5cX9hLqlUlpmszhwNLt6WDXyvCkf4vgXAWVGidji7LQNjImaMP1gl2RQORUfeA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319246; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=XblXgIPBh/JTrvw0njHIhz1RADWLgtQDj9QvCcfZTjY=; b=mVCBpwzMV4hlec0E08oXcy9bTkJAjaH9qqV4ayrKhi2ilX659IEMG7r2ynY5pfIdSIts CNuh/R84hXTCoKfB/XBMhJvmRAkhydnOlUXVpiMw2NMf3z8JET5bnRudiZcow7cg3X2BN 4COm0OUliV6qYlehYRIf7wOBjHRn9z6UUIyQJ+L/pEwxnpW5vwsR20ND/W/k6n4f/Fu0J WGQJxKPHBXYjIJGnQfOjdcaBxdaH1WsJDG47IU7QgVvwCFB/kwGc35r3HXWEKNDJKWJv6 h4MZHJxAazWUoO7zKJSmmvAosZlBEvnFlyrbntGKmIVaioxZgRdai8b8zBsX+5Nf+GA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NsDY7vsL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4398E606A32C; Thu, 3 Dec 2026 17:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NsDY7vsL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AC491F00893; Thu, 3 Dec 2026 17:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796319245; bh=XblXgIPBh/JTrvw0njHIhz1RADWLgtQDj9QvCcfZTjY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NsDY7vsLkD38A0+GCHhpGHGGsp62wxe/uXpJ2Pc3soU9Bl8R4ShVx36q0KSknJAt/ uYWSp4Sy+f9Ib1ME4Xz4H/gPiGXH7D5VTe4ixYchDKVbRMzxAAlNSqesAAWAEV99S2 LTyOqbVEZt64bYgYhNkWhn4NWF1RqNwlk9k3T1e1KT76/ScgChTm1wFNTqjkPTiUEe Nra+BQxtY2rw7n/NO+1i2405uJsBqkFp3XElGnk4BbBk9JYxr1la5j7DTdSaixeECw WWakai8AXtZKHVz8Cm2FG4HDUH+QwUZLQsQXVJA2NBz+lMhjh9QRYcIui91tURIzFE PF82fhHf560BA== Subject: Re: [PATCH net-next 1/2] ipv6: Use the FIB prefix length when suppressing cached routes From: netdev-bot+sashiko@kernel.org To: leonard@lausen.nl Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, pablo@netfilter.org, fw@strlen.de, phil@nwl.cc, shuah@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kselftest@vger.kernel.org Date: Thu, 03 Dec 2026 17:34:03 +0000 Message-ID: <179631924394.3146.336826619374005468@kernel.org> In-Reply-To: <20261202173023.17220-2-leonard@lausen.nl> References: <20261202173023.17220-2-leonard@lausen.nl> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] The fix reads the prefix length from rt->from, the route that created the cached exception. - [Low] Baseline decision: false positive. -- ipv6: Use the FIB prefix length when suppressing cached routes This patch changes fib6_rule_suppress() so that suppress_prefixlen is compared against the prefix length of the parent FIB entry (rt->from) instead of rt6i_dst.plen. PMTU and redirect exceptions are /128 even under a default route, so they could slip past suppress_prefixlength 0. If the parent is gone, the old rt6i_dst.plen check is still used. Link: https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/ > diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c > index 7efb0515b5c8b..2f43e4e48e0d0 100644 > --- a/net/ipv6/fib6_rules.c > +++ b/net/ipv6/fib6_rules.c [ ... ] > @@ -298,10 +300,13 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule, > if (rt->rt6i_idev) > dev = rt->rt6i_idev->dev; > > + from = rcu_dereference(rt->from); > + plen = from ? from->fib6_dst.plen : rt->rt6i_dst.plen; > + [Severity: High] Is rt->from always the fib6_info that was matched in the table this rule is evaluating? When routes use nexthop objects, the exception bucket lives in the nexthop's shared fib6_nh. Every fib6_info that references the same nhid shares that bucket, across tables. fib6_check_nexthop() says as much: net/ipv4/nexthop.c:fib6_check_nexthop() { /* fib6_src is unique to a fib6_info and limits the ability to cache * routes in fib6_nh within a nexthop that is potentially shared * across multiple fib entries. ... } ip6_pol_route()->rt6_find_cached_rt() finds the bucket through res->nh. It then matches only on daddr, plus saddr when subtrees are enabled: net/ipv6/route.c:rt6_find_cached_rt() { ... bucket = fib6_nh_get_excptn_bucket(res->nh, NULL); rt6_ex = __rt6_find_exception_rcu(&bucket, daddr, src_key); ... } Nothing checks that rt6_ex->rt6i->from == res->f6i. One bucket can hold exceptions with different parents, which is why fib6_nh_flush_exceptions() filters on ->from: net/ipv6/route.c:fib6_nh_flush_exceptions() { ... if (!from || rcu_access_pointer(rt6_ex->rt6i->from) == from) rt6_remove_exception(bucket, rt6_ex); ... } Can the bypass still happen with a setup like this? ip -6 rule add fwmark 1 lookup 200 ip -6 rule add lookup main suppress_prefixlength 0 ip -6 rule add lookup 100 (VPN table) table 200: 2001:db8::/32 via nhid 1 main: default via nhid 1 1. A remote ICMPv6 Packet Too Big arrives for a marked flow to D. __ip6_rt_update_pmtu() sets res.f6i to the /32 route and res.nh to the shared fib6_nh, then calls rt6_insert_exception(). 2. An unmarked flow to D matches the default route in main. rt6_find_cached_rt() returns the exception from step 1. 3. fib6_rule_suppress() computes plen as 32. That is greater than 0, so the route is not suppressed. The traffic then leaves via main instead of falling through to table 100. The opposite direction looks like a new regression. Suppose the exception was created through a default route (from->fib6_dst.plen == 0), and another table matches a more specific route on the same nexthop: - The old code saw plen 128 and accepted the route. - With this patch, plen is 0, so the specific route is suppressed and the lookup falls through to later rules. The fib6_table_lookup branch above already uses res->f6i->fib6_dst.plen, which is the entry matched in this table. On the rt6_info path, the matched res.f6i in ip6_pol_route() is dropped before fib6_rule_suppress() runs. Could the matched entry be passed through instead? Another option would be for rt6_find_cached_rt() to skip exceptions whose ->from does not match res->f6i. The selftest added later in the series does not use nexthop objects, so it would not catch this case. > /* do not accept result if the route does > * not meet the required prefix length > */ > - if (rt->rt6i_dst.plen <= rule->suppress_prefixlen) > + if (plen <= rule->suppress_prefixlen) > goto suppress_route; [Severity: Low] This isn't a bug, but with only this patch applied, no in-tree test reaches the rt6_info branch of fib6_rule_suppress() with a cached /128 exception under suppress_prefixlength 0. The IPv6 suppression cases in nft_fib.sh go through fib6_lookup() with lookup_ptr == fib6_table_lookup. fib_suppress_test() in fib_tests.sh only checks that nothing crashes. The next patch in the series closes this gap. It is "selftests: netfilter: cover IPv6 prefix suppression with a PMTU exception" and adds a "suppress cached default route" case to nft_fib.sh. That case creates an MTU 1280 exception under the default route. It then checks the device returned by: ip -6 route get dead:1::99 from dead:1::1 That lookup goes through ip6_pol_route() and reaches the new rt->from logic. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202173023.17220-1-leonard%40lausen.nl