All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: netdev@vger.kernel.org
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Paul Moore <paul@paul-moore.com>,
	Matthieu Baerts <matttbe@kernel.org>,
	Mat Martineau <martineau@kernel.org>,
	Geliang Tang <geliang@kernel.org>, Julian Anastasov <ja@ssi.bg>,
	Allison Henderson <achender@kernel.org>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Xin Long <lucien.xin@gmail.com>,
	"D. Wythe" <alibuda@linux.alibaba.com>,
	Dust Li <dust.li@linux.alibaba.com>,
	Sidraya Jayagond <sidraya@linux.ibm.com>,
	Mahanta Jambigi <mjambigi@linux.ibm.com>,
	Tony Lu <tonylu@linux.alibaba.com>,
	Wen Gu <guwen@linux.alibaba.com>,
	linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org,
	coreteam@netfilter.org, bridge@lists.linux.dev,
	linux-security-module@vger.kernel.org, mptcp@lists.linux.dev,
	lvs-devel@vger.kernel.org, linux-rdma@vger.kernel.org,
	rds-devel@oss.oracle.com, linux-sctp@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: [PATCH net-next 00/14] net: annotate data-races around sysctl knobs
Date: Mon,  9 Nov 2026 10:51:59 +0800	[thread overview]
Message-ID: <20261109025425.328445-1-jiayuan.chen@linux.dev> (raw)

While testing the recent sysctl range fixes I noticed that a lot of our
sysctl knobs are read with plain loads while the handlers update them
with WRITE_ONCE() and no lock, so KCSAN reports them as data races. I
then used an LLM to go through every ctl_table under net/ and list the
readers that were left behind. This series annotates them with
READ_ONCE(), and adds WRITE_ONCE() to a few custom handlers and netlink
paths that store to the same fields with plain writes. Most of it is a
plain READ_ONCE() at each read; where a function reads the same knob
twice to make one decision, it now reads it once into a local, so the
comparison and the value it acts on cannot come from two different
writes.

There are no Fixes tags. Done one knob per patch this would be well over
a hundred commits, so I grouped them by subsystem and feature instead to
keep the review manageable. If maintainers prefer, I can split it up
further with a Fixes tag on each one, as several smaller series.

No functional change. KCSAN does hit these, e.g. toggling
net.ipv6.icmp.echo_ignore_all while receiving ICMPv6 echo requests:

  BUG: KCSAN: data-race in icmpv6_rcv / proc_dou8vec_minmax

  write (marked) to 0xffffffff8ee2940d of 1 bytes by task 504 on cpu 0:
   proc_dou8vec_minmax+0x1ab/0x1f0
   proc_sys_call_handler+0x282/0x3a0
   proc_sys_write+0x13/0x20
   ...

  read to 0xffffffff8ee2940d of 1 bytes by interrupt on cpu 3:
   icmpv6_rcv+0x99d/0xd40
   ip6_protocol_deliver_rcu+0x787/0x9a0
   ip6_input_finish+0xb0/0x1b0
   ip6_input+0xa8/0x250
   ipv6_rcv+0x14b/0x1c0
   ...

  value changed: 0x01 -> 0x00

Jiayuan Chen (14):
  ipv4: annotate data-races around ip_rt_* sysctls
  inet: frags: annotate data-races around fqdir->timeout and
    fqdir->max_dist
  ipv6: annotate data-races around addrconf sysctls
  ipv6: annotate data-races around icmpv6 reply sysctls
  calipso: annotate data-races around cache sysctls
  sctp: annotate data-races around sctp sysctls
  mptcp: annotate data-races around pernet sysctls
  rds: annotate data-races around core rds sysctls
  netfilter: conntrack: annotate data-races around conntrack sysctls
  netfilter: bridge: annotate data-races around br_netfilter and nf_log
    sysctls
  ipvs: annotate data-races around lblc_expiration and lblcr_expiration
  net/smc: annotate data-races around smc sysctls
  netfilter: conntrack: annotate data-races around timeout and tcp
    sysctls
  netfilter: cttimeout: annotate data-races around the default timeouts

 include/net/ipv6.h                            |   2 +-
 include/net/netfilter/nf_conntrack_acct.h     |   6 +-
 .../net/netfilter/nf_conntrack_timestamp.h    |   2 +-
 net/bridge/br_netfilter_hooks.c               |  20 ++--
 net/bridge/netfilter/ebt_log.c                |   2 +-
 net/ipv4/inet_fragment.c                      |   2 +-
 net/ipv4/ip_fragment.c                        |   6 +-
 net/ipv4/route.c                              |  34 +++---
 net/ipv6/addrconf.c                           |  22 ++--
 net/ipv6/calipso.c                            |   6 +-
 net/ipv6/icmp.c                               |  10 +-
 net/ipv6/ndisc.c                              |   2 +-
 net/ipv6/route.c                              |   8 +-
 net/mptcp/ctrl.c                              |  18 +--
 net/netfilter/ipvs/ip_vs_lblc.c               |   2 +-
 net/netfilter/ipvs/ip_vs_lblcr.c              |   2 +-
 net/netfilter/nf_conntrack_core.c             |   8 +-
 net/netfilter/nf_conntrack_ecache.c           |   2 +-
 net/netfilter/nf_conntrack_expect.c           |   2 +-
 net/netfilter/nf_conntrack_netlink.c          |   2 +-
 net/netfilter/nf_conntrack_proto.c            |   6 +-
 net/netfilter/nf_conntrack_proto_generic.c    |   8 +-
 net/netfilter/nf_conntrack_proto_gre.c        |  20 ++--
 net/netfilter/nf_conntrack_proto_icmp.c       |  12 +-
 net/netfilter/nf_conntrack_proto_icmpv6.c     |  12 +-
 net/netfilter/nf_conntrack_proto_sctp.c       |  13 ++-
 net/netfilter/nf_conntrack_proto_tcp.c        | 110 +++++++++---------
 net/netfilter/nf_conntrack_proto_udp.c        |  24 ++--
 net/netfilter/nf_flow_table_core.c            |   4 +-
 net/netfilter/nf_log_syslog.c                 |   2 +-
 net/rds/recv.c                                |   2 +-
 net/rds/send.c                                |   8 +-
 net/rds/threads.c                             |   4 +-
 net/sctp/associola.c                          |   2 +-
 net/sctp/bind_addr.c                          |   2 +-
 net/sctp/endpointola.c                        |  14 +--
 net/sctp/input.c                              |   2 +-
 net/sctp/sm_make_chunk.c                      |   6 +-
 net/sctp/sm_sideeffect.c                      |   2 +-
 net/sctp/sm_statefuns.c                       |   6 +-
 net/sctp/socket.c                             |  46 ++++----
 net/sctp/sysctl.c                             |  16 +--
 net/sctp/transport.c                          |   6 +-
 net/smc/af_smc.c                              |   8 +-
 net/smc/smc_clc.c                             |   8 +-
 net/smc/smc_core.c                            |   2 +-
 net/smc/smc_tx.c                              |   2 +-
 47 files changed, 259 insertions(+), 246 deletions(-)

-- 
2.43.0


             reply	other threads:[~2026-11-09  2:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  2:51 Jiayuan Chen [this message]
2026-11-09  2:52 ` [PATCH net-next 01/14] ipv4: annotate data-races around ip_rt_* sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-10  5:53   ` netdev-bot+sashiko
2026-11-09  2:52 ` [PATCH net-next 02/14] inet: frags: annotate data-races around fqdir->timeout and fqdir->max_dist Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-09  2:52 ` [PATCH net-next 03/14] ipv6: annotate data-races around addrconf sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-09  2:52 ` [PATCH net-next 04/14] ipv6: annotate data-races around icmpv6 reply sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-09  2:52 ` [PATCH net-next 05/14] calipso: annotate data-races around cache sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-10  5:53   ` netdev-bot+sashiko
2026-11-09  2:52 ` [PATCH net-next 06/14] sctp: annotate data-races around sctp sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-10  5:53   ` netdev-bot+sashiko
2026-11-09  2:52 ` [PATCH net-next 07/14] mptcp: annotate data-races around pernet sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-10 11:28   ` Matthieu Baerts
2026-11-09  2:52 ` [PATCH net-next 08/14] rds: annotate data-races around core rds sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-09  2:52 ` [PATCH net-next 09/14] netfilter: conntrack: annotate data-races around conntrack sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-09  2:52 ` [PATCH net-next 10/14] netfilter: bridge: annotate data-races around br_netfilter and nf_log sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-10  5:53   ` netdev-bot+sashiko
2026-11-09  2:52 ` [PATCH net-next 11/14] ipvs: annotate data-races around lblc_expiration and lblcr_expiration Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-09  2:52 ` [PATCH net-next 12/14] net/smc: annotate data-races around smc sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-12  4:54   ` Dust Li
2026-11-09  2:52 ` [PATCH net-next 13/14] netfilter: conntrack: annotate data-races around timeout and tcp sysctls Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-09  2:52 ` [PATCH net-next 14/14] netfilter: cttimeout: annotate data-races around the default timeouts Jiayuan Chen
2026-11-10  3:01   ` sashiko-bot
2026-11-10  5:53   ` netdev-bot+sashiko
2026-11-09  3:11 ` [PATCH net-next 00/14] net: annotate data-races around sysctl knobs Jason Xing
2026-11-09  3:33   ` Jiayuan Chen
2026-11-09  6:52     ` Jason Xing
2026-11-09  4:59 ` MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261109025425.328445-1-jiayuan.chen@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=achender@kernel.org \
    --cc=alibuda@linux.alibaba.com \
    --cc=bridge@lists.linux.dev \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=geliang@kernel.org \
    --cc=guwen@linux.alibaba.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=ja@ssi.bg \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=lvs-devel@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mjambigi@linux.ibm.com \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=paul@paul-moore.com \
    --cc=phil@nwl.cc \
    --cc=razor@blackwall.org \
    --cc=rds-devel@oss.oracle.com \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.