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=1796460404; b=S5lIKQHqFB9qFNscW5Ev3ibmU3iHiCJ/cWWtwZaWV2UorXMi3aF3ZsDVgNOsqIYzHv9T +yPne0nbMt6sk5s5lSC2qM774A/B4+SiKvGPJDZivupIoDh6AbpTd/4l9Mg8zAv5VlXZS +GO0dxxx8X9l7sbgJFHSlFRs78qhXNgXaevxkcTfknQD8dGAmC+L1wOlVfpDrEQ9z2mMo Mk2jSeS3WcK3BxwYnhFL5t4iZMiE9GyfxyLNh16TL2z5pz9P98FZP1EtpToaFwTZEON1m S0WeHlNlwLfVplmgfJ8tQIBcWROPr2rk6nK+TMwmOmN10cQ0OmEl6RVx+1qaidKE0Ig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796460404; 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=SlmO9mPKehMke/ph6tWfgBXTcC7ZQWSEenMEv1bsb0M=; b=byteGoJy7D3flhfEGJjmB/8wVzrA3ZRQ0iXeFH7QcA1XBAXc0s/cSrWcld/vxty62NWJ DijaqYgf1AUQF7jb5q+VGxK8PpjHRw2AqmBdf2PWhb4wd8LagI8KZOQD//b3G9QVb/viv lltQ4E8s2OdUobS5rT7xvM2t6DKGrR3EkKw1sx4BaMBDN00HjIGtrjVr6cg+DRxwc3LOv NUa2Lw/lWz/I06aiINbAfq2qj5zKYq6LanwzTH/VF+MRYMX1UTBPZi5yshzc7MWsrK3gA FbMtEbTtjr/VMyzm0Cb0ylIjHENyyk10Saiv3TxcdnzbCKSXMQI6cycvFN0S5+FZ+hA== 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=grG7XQah; 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 6BD59606A322 for ; Sat, 5 Dec 2026 08:46:44 +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=grG7XQah Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8576C1F00936; Sat, 5 Dec 2026 08:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796460404; bh=SlmO9mPKehMke/ph6tWfgBXTcC7ZQWSEenMEv1bsb0M=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=grG7XQahMWsSANgITkBOyuMoAXx10hzri6eBmoogqn8tKC7UPE+Udfqp7/EQNzNLx ecJ8b78WSwfDqcwXTt44/ENrjoiWZTSDR7Il73avpvU2u+7c4jmXmz3oCPjW1JYyNj a6+l2vO/a21am7/lTs2GHhU4b1ISWQkrTlVlI8dX28UhxxJ0olk8+aa1vNd8j3X8Aa Z9yPdnhpSoBLHMyyKw8jQV9mVWpnHSulz79NGZHJKgOFP1ei3YghzqbE1UQIKKjNS8 GnBSZ5ISbXBIZXH3Qdc8elXWTdmvb80v/QEDRPyMbxmFiOaSY5Zkp63raNzC1zwD7T vdz4xftovaltA== Subject: Re: [PATCH net] macvlan: drop the conntrack entry of broadcast clones From: netdev-bot+sashiko@kernel.org To: kyuwon.cho@skku.edu Cc: kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, davem@davemloft.net, andrew+netdev@lunn.ch, pablo@netfilter.org, fw@strlen.de, netdev@vger.kernel.org Date: Sat, 05 Dec 2026 08:46:43 +0000 Message-ID: <179646040307.3146.69323079833219430@kernel.org> In-Reply-To: <179607207068.562302.5326868635249894085@skku.edu> References: <179607207068.562302.5326868635249894085@skku.edu> 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 3 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 2 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 is incomplete: the same macvlan clone path that shares an unconfirmed conntrack entry is still reachable through source-mode… - [Low] The commit message says "In bridge mode the clone goes through __dev_forward_skb(), which drops its conntrack entry, but in the other… - [Low] The commit message (title "drop the conntrack entry of broadcast clones", body "Drop the conntrack entry of the clone") presents the… -- macvlan: drop the conntrack entry of broadcast clones This patch adds nf_reset_ct() to macvlan_broadcast_one() for the non-local case. Broadcast and multicast clones handed to macvlan devices then stop sharing an unconfirmed conntrack entry that tc act_ct attached on the lower device. Before the patch, one skb could krealloc() the ct extension area while another skb was still reading it. > macvlan_broadcast_one() hands a clone of a broadcast or multicast frame > to each macvlan device. In bridge mode the clone goes through > __dev_forward_skb(), which drops its conntrack entry, but in the other > modes it keeps the entry of the original skb. [Severity: Low] Does this description match received frames? In macvlan_broadcast(), local comes from the flood mask the caller passes in, not from the target vlan's mode: drivers/net/macvlan.c:macvlan_broadcast() { ... err = macvlan_broadcast_one(nskb, vlan, eth, mode == MACVLAN_MODE_BRIDGE) ?: netif_rx(nskb); ... } Every RX caller in macvlan_multicast_rx() passes a multi-bit mask, either MACVLAN_MODE_VEPA | MACVLAN_MODE_BRIDGE or that pair plus MACVLAN_MODE_PRIVATE and MACVLAN_MODE_PASSTHRU. So local is false for every target, bridge-mode macvlans included. Only the TX flood in macvlan_queue_xmit() passes exactly MACVLAN_MODE_BRIDGE. That means bridge-mode macvlans receiving broadcast or multicast from the lower device were affected just like private or VEPA ones before this patch. Could the commit message be reworded so it doesn't suggest bridge-mode setups were safe? > Drop the conntrack entry of the clone, as __dev_forward_skb() does and > as act_mirred does since commit d09c548dbf3b ("net: sched: act_mirred: > Reset ct info when mirror/redirect skb"). [Severity: Low] The subject and this paragraph say only clones are affected. However, macvlan_handle_frame() also calls macvlan_broadcast_one() on the original, non-cloned skb: drivers/net/macvlan.c:macvlan_handle_frame() { ... if (mode != MACVLAN_MODE_VEPA && mode != MACVLAN_MODE_BRIDGE) { /* forward to original port. */ vlan = src; ret = macvlan_broadcast_one(skb, vlan, eth, 0) ?: __netif_rx(skb); ... } Since local is 0 here, the new nf_reset_ct() also drops the ct of the original skb. This happens when a multicast frame's source MAC belongs to a private, passthru or source-mode macvlan. Netfilter on the upper device used to see that entry, for example one set by tc act_ct with a zone on the lower device, and now it won't. This is probably intended and matches __dev_forward_skb(). Could the commit message mention it? > diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c > index 4f8416bb5169b..237744d6bfc2d 100644 > --- a/drivers/net/macvlan.c > +++ b/drivers/net/macvlan.c > @@ -237,6 +237,7 @@ static int macvlan_broadcast_one(struct sk_buff *skb, > if (local) > return __dev_forward_skb(dev, skb); > > + nf_reset_ct(skb); [Severity: High] Does the source-mode clone path in the same receive handler need the same reset? macvlan_forward_source_one() clones the skb and passes the clone to __netif_rx() without dropping its conntrack entry: drivers/net/macvlan.c:macvlan_forward_source_one() { ... nskb = skb_clone(skb, GFP_ATOMIC); if (!nskb) return; len = nskb->len + ETH_HLEN; nskb->dev = dev; ... ret = __netif_rx(nskb); ... } skb_clone()->__copy_skb_header()->__nf_copy() copies _nfct and takes a reference. The clone therefore shares the original skb's unconfirmed nf_conn. macvlan_handle_frame() calls macvlan_forward_source() on both the multicast branch and the unicast branch. Unless a matching vlan has MACVLAN_FLAG_NODST, the original skb keeps going with the same ct. It can return RX_HANDLER_PASS, be retargeted with RX_HANDLER_ANOTHER, or go through the broadcast/multicast or forward-to-original-port paths. Several source-mode macvlans can also register the same source MAC, which gives more than one clone. With tc act_ct on the lower device's ingress, wouldn't this trigger the same use-after-free and double-free from the commit message? The path is nft_ct_expect_obj_eval()->nf_ct_helper_ext_add()->nf_ct_ext_add() and its krealloc(). The only difference is a source-mode macvlan (ip link add ... type macvlan mode source) in place of a private-mode one. Would adding nf_reset_ct(nskb) after skb_clone() in macvlan_forward_source_one() fix this too? > skb->dev = dev; > if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast)) > skb->pkt_type = PACKET_BROADCAST; -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179607207068.562302.5326868635249894085%40skku.edu