[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_284407955020261D1B2BD142194A87C9EB0A@qq.com>
Date: Tue, 23 Apr 2024 19:50:22 +0800
From: linke li <lilinke99@...com>
To:
Cc: xujianhao01@...il.com,
linke li <lilinke99@...com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Florian Westphal <fw@...len.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
netfilter-devel@...r.kernel.org,
coreteam@...filter.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] netfilter: mark racy access on ext->gen_id
In __nf_ct_ext_find(), ext->gen_id can be changed by
nf_ct_ext_valid_post(), using WRITE_ONCE. Mark data races on ext->gen_id
as benign using READ_ONCE.
This patch is aimed at reducing the number of benign races reported by
KCSAN in order to focus future debugging effort on harmful races.
Signed-off-by: linke li <lilinke99@...com>
---
net/netfilter/nf_conntrack_extend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
index dd62cc12e775..7f1a5e5f6646 100644
--- a/net/netfilter/nf_conntrack_extend.c
+++ b/net/netfilter/nf_conntrack_extend.c
@@ -141,7 +141,7 @@ void *__nf_ct_ext_find(const struct nf_ct_ext *ext, u8 id)
if (!__nf_ct_ext_exist(ext, id))
return NULL;
- if (this_id == 0 || ext->gen_id == gen_id)
+ if (this_id == 0 || READ_ONCE(ext->gen_id) == gen_id)
return (void *)ext + ext->offset[id];
return NULL;
--
2.39.3 (Apple Git-146)
Powered by blists - more mailing lists