Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by zhuorao yang
Tue, 01 Dec 2026 08:58
[PATCH net] netfilter: conntrack: serialize helper extension allocation
Author: zhuorao yang
Date: Tue, 01 Dec 2026 08:58
Date: Tue, 01 Dec 2026 08:58
59 lines
12947 bytes
12947 bytes
Two CPUs can add the helper extension to the same unconfirmed conntrack
when shared skbs are evaluated concurrently. nf_ct_ext_add() then calls
krealloc() on the same ct->ext from both CPUs. If the first call moves
the extension allocation, the second call can double-free the old one.
Serialize nf_ct_helper_ext_add() with the conntrack lock. The lock also
covers publishing IPS_HELPER_BIT and initializing the expectation list,
so a concurrent caller observes a fully initialized helper extension.
Fixes: 1a64edf54f55 ("netfilter: nft_ct: add helper set support")
Signed-off-by: zhuorao yang <alex000young@gmail.com>
---
Vulnerability report
Affected versions: Linux 7.4.0-rc5 at
fe6ff8d5d675c01793b9f051d16055dd4aa75244; the helper-set path dates to
v4.12.
Trigger conditions: CONFIG_NFT_CT and CAP_NET_ADMIN in the target
network namespace. Two skbs must share the same unconfirmed conntrack
and execute nft_ct_helper_obj_eval() concurrently on different CPUs.
Existing accounting, timestamp, event-cache, or label extensions make
the helper extension enlarge and relocate ct->ext.
Reproducer status: A QEMU KASAN harness forced two CPUs to enter
nf_ct_helper_ext_add() on the same unconfirmed conntrack with a
104-byte extension allocation. The unpatched kernel produced a double-
free in krealloc_node_align_noprof. With the fix, 1000 synchronized
two-CPU iterations completed without KASAN. The exact shared-skbs
network path has not yet been shown without the test harness.
Reproducer material is intentionally withheld from this public message.
AI assistance: DeepSeek identified the issue and drafted the patch.
The submitter reviewed the code and certified the Developer Certificate
of Origin.
net/netfilter/nf_conntrack_helper.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index c30ae3f203be..4d2dd88e74f3 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -184,11 +184,13 @@ nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp)
{
struct nf_conn_help *help;
+ spin_lock_bh(&ct->lock);
help = nf_ct_ext_add(ct, NF_CT_EXT_HELPER, gfp);
if (help) {
__set_bit(IPS_HELPER_BIT, &ct->status);
INIT_HLIST_HEAD(&help->expectations);
}
+ spin_unlock_bh(&ct->lock);
return help;
}
EXPORT_SYMBOL_GPL(nf_ct_helper_ext_add);
--
2.56.0
Re: [PATCH net] netfilter: conntrack: serialize helper extension allocation
Author: Pablo Neira Ayuso
Date: Tue, 01 Dec 2026 09:21
Date: Tue, 01 Dec 2026 09:21
17 lines
9046 bytes
9046 bytes
On Tue, Dec 01, 2026 at 04:58:14PM +0800, zhuorao yang wrote: > Two CPUs can add the helper extension to the same unconfirmed conntrack > when shared skbs are evaluated concurrently. nf_ct_ext_add() then calls > krealloc() on the same ct->ext from both CPUs. If the first call moves > the extension allocation, the second call can double-free the old one. > > Serialize nf_ct_helper_ext_add() with the conntrack lock. The lock also > covers publishing IPS_HELPER_BIT and initializing the expectation list, > so a concurrent caller observes a fully initialized helper extension. Thanks for your yet another duplicated patch. Please, follow up the mailing list before posting duplicated patches. Talking to the chat bot is not sufficient, you have to keep track on the mailing list.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads