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. If tc act_ct attached an unconfirmed conntrack entry at the ingress of the lower device, the original skb and the clones then share one unconfirmed entry, while netfilter treats an unconfirmed entry as owned by a single skb. When one of them adds a conntrack extension, e.g. the helper extension that an nft ct expectation object adds, krealloc() frees the extension area that the others still read: BUG: KASAN: slab-use-after-free in nft_ct_get_eval (include/net/netfilter/nf_conntrack_extend.h:46 include/net/netfilter/nf_conntrack_labels.h:28 net/netfilter/nft_ct.c:117) Read of size 1 at addr ff11000013ec5507 by task kworker/u8:0/13 Call Trace: nft_ct_get_eval (net/netfilter/nft_ct.c:117) nft_do_chain (net/netfilter/nf_tables_core.c:237 net/netfilter/nf_tables_core.c:285) nft_do_chain_ipv4 (net/netfilter/nft_chain_filter.c:24) nf_hook_slow (net/netfilter/core.c:633) ip_rcv (net/ipv4/ip_input.c:618) __netif_receive_skb_one_core (net/core/dev.c:6451) process_backlog (net/core/dev.c:6917) Freed by task 114: krealloc_node_align_noprof (mm/slub.c:7098) nf_ct_ext_add (net/netfilter/nf_conntrack_extend.c:115) nf_ct_helper_ext_add (net/netfilter/nf_conntrack_helper.c:187) nft_ct_expect_obj_eval (net/netfilter/nft_ct.c:1432) nft_do_chain (net/netfilter/nf_tables_core.c:232 net/netfilter/nf_tables_core.c:285) Two such adds free the area twice (KASAN double-free in krealloc_node_align_noprof()). 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"). Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct") Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Kyuwon Cho --- The issue was found by an LLM-guided test generator that we are developing as a research prototype. Any user reaches it from its own user and network namespace. Our reproducer puts tc act_ct (and a mirred mirror) on the ingress of a veth peer with two private-mode macvlan devices on top, adds an nft ct expectation object and a ct labels read in prerouting, and sends a burst of broadcast UDP frames. Both use-after-free reads and double frees (KASAN double-free in krealloc_node_align_noprof()) show up. With the patch the frames go through and nothing is reported. The reproducer is available on request. Found and tested on mainline fe6ff8d5d675 (v7.4-rc5, with KASAN); the patch is against net (76fca30e8d34). drivers/net/macvlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 4f8416bb5169..237744d6bfc2 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); skb->dev = dev; if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast)) skb->pkt_type = PACKET_BROADCAST; -- 2.43.0