On Mon, Nov 09, 2026 at 10:52:08AM +0800, Jiayuan Chen wrote:
nf_conntrack_acct, nf_conntrack_events, nf_conntrack_timestamp,
nf_conntrack_checksum, nf_conntrack_log_invalid, nf_conntrack_max and
nf_conntrack_expect_max are read without any lock while their sysctl
handlers update them with WRITE_ONCE(), and nf_ct_set_acct() stores
sysctl_acct with a plain write. Add READ_ONCE() to the readers and
WRITE_ONCE() to nf_ct_set_acct().
KCSAN reports it when nf_conntrack_checksum is changed while packets go
through conntrack:
BUG: KCSAN: data-race in nf_conntrack_icmpv4_error / proc_dou8vec_minmax
write (marked) to 0xffffffff8ee29b6d of 1 bytes by task 568 on cpu 0:
proc_dou8vec_minmax+0x1ab/0x1f0
proc_sys_call_handler+0x282/0x3a0
proc_sys_write+0x13/0x20
...
read to 0xffffffff8ee29b6d of 1 bytes by interrupt on cpu 2:
nf_conntrack_icmpv4_error+0xb3/0x240
nf_conntrack_in+0xa85/0xb20
ipv4_conntrack_local+0xb0/0x120
nf_hook_slow+0x7e/0x180
nf_hook+0x1fa/0x4e0
__ip_local_out+0x1ac/0x3f0
ip_push_pending_frames+0x65/0x160
icmp_push_reply+0x17a/0x200
__icmp_send+0xb7d/0x1a10
udp_rcv+0x95c/0x14e0
...
value changed: 0x00 -> 0x01
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
It might be worth splitting off this and other netfilter (and IPVS) patches
into a separate patch-set for nf-next rather than net-next. As that is the
usual path for such patches.
But at any rate these change look good to me.
Reviewed-by: Simon Horman <horms@kernel.org>
...