Article View: linux.kernel.netdev
Article #18301[PATCH net-next v2 2/5] ipv6: annotate data-races around icmpv6 reply sysctls
From: Jiayuan Chen
Date: Wed, 18 Nov 2026 04:51
Date: Wed, 18 Nov 2026 04:51
89 lines
11780 bytes
11780 bytes
icmpv6_echo_ignore_all, icmpv6_echo_ignore_multicast,
icmpv6_echo_ignore_anycast, anycast_src_echo_reply and fwmark_reflect are
read without any lock while their sysctl handlers update them with
WRITE_ONCE(). Add READ_ONCE() to the readers.
KCSAN reports it when net.ipv6.icmp.echo_ignore_all is changed while
ICMPv6 echo requests are received:
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
__netif_receive_skb_one_core+0x8f/0xe0
...
value changed: 0x01 -> 0x00
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
---
include/net/ipv6.h | 2 +-
net/ipv6/icmp.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 579df1516d251..b77dc5c3ea268 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -199,7 +199,7 @@ struct sk_buff *ip6_frag_next(struct sk_buff *skb,
struct ip6_frag_state *state);
#define IP6_REPLY_MARK(net, mark) \
- ((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0)
+ (READ_ONCE((net)->ipv6.sysctl.fwmark_reflect) ? (mark) : 0)
#include <net/sock.h>
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 4122ce3055e49..abfe2893c18f4 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -946,17 +946,17 @@ static enum skb_drop_reason icmpv6_echo_reply(struct sk_buff *skb)
u8 type;
if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) &&
- net->ipv6.sysctl.icmpv6_echo_ignore_multicast)
+ READ_ONCE(net->ipv6.sysctl.icmpv6_echo_ignore_multicast))
return reason;
saddr = &ipv6_hdr(skb)->daddr;
acast = ipv6_anycast_destination(skb_dst(skb), saddr);
- if (acast && net->ipv6.sysctl.icmpv6_echo_ignore_anycast)
+ if (acast && READ_ONCE(net->ipv6.sysctl.icmpv6_echo_ignore_anycast))
return reason;
if (!ipv6_unicast_destination(skb) &&
- !(net->ipv6.sysctl.anycast_src_echo_reply && acast))
+ !(READ_ONCE(net->ipv6.sysctl.anycast_src_echo_reply) && acast))
saddr = NULL;
if (icmph->icmp6_type == ICMPV6_EXT_ECHO_REQUEST)
@@ -1160,11 +1160,11 @@ static int icmpv6_rcv(struct sk_buff *skb)
switch (type) {
case ICMPV6_ECHO_REQUEST:
- if (!net->ipv6.sysctl.icmpv6_echo_ignore_all)
+ if (!READ_ONCE(net->ipv6.sysctl.icmpv6_echo_ignore_all))
reason = icmpv6_echo_reply(skb);
break;
case ICMPV6_EXT_ECHO_REQUEST:
- if (!net->ipv6.sysctl.icmpv6_echo_ignore_all &&
+ if (!READ_ONCE(net->ipv6.sysctl.icmpv6_echo_ignore_all) &&
READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe))
reason = icmpv6_echo_reply(skb);
break;
--
2.43.0
Technical Details
Message-ID:
<20261118045137.174026-3-jiayuan.chen@linux.dev>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365866-linux-kernel-netdev=dewy.ruReferences:
<20261118045137.174026-1-jiayuan.chen@linux.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365866-linux-kernel-netdev=dewy.ru From: jiayuan.chen@linux.dev (Jiayuan Chen) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v2 2/5] ipv6: annotate data-races around icmpv6 reply sysctls Date: Wed, 18 Nov 2026 12:51:17 +0800 Organization: Usenet Network Message-ID: <20261118045137.174026-3-jiayuan.chen@linux.dev> References: <20261118045137.174026-1-jiayuan.chen@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2506559"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:DewU+GPRF66WF97BbjH6VHyMREM= sha256:nWLlcB6yfsIJQT++etuec2fMYRZvE2XrhQ2EchGy8cY= sha1:zTyuHM+Cosblx5u6Q3X8GmbJSh8= sha256:5c6djsCiX+2r20i8lpIjaYrXcpAUlyPaA4VhugqW5Zg= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 9E8F71151A0; Wed, 18 Nov 2026 07:52:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.151 X-Spam-Status: No, score=-2.151 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HK_RANDOM_FROM=1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id amHw_Zhwivb1; Wed, 18 Nov 2026 07:52:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-365866-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id B30F711519E; Wed, 18 Nov 2026 07:52:35 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 65817614B9C; Wed, 18 Nov 2026 04:52:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794977548; b=kRgVVIHpVqJRbHhwhxDahiU2MPA2IJGmMO0VaUr+JgBxv/zd44VW95VvzvevLDJtq/Fe oC2lndBisqKq0bYUVSklXM8915PHq9e8i60yAFMeIcsxteXINTQ1AZbrShNXIGqFIJAur R+7o4fDPS1bkYsZNkMpnqMzfdOKDtCOO+iIwix+Mg8F1YmbzkEcCsL9FWZ6XLL5QguXND TIRj1QKr1ygHO5QnCSN+B3/8IzkBMz0y9/offV6n+bW28vbLx5Q7kumEPcMd3HyrHHA5Z qnMlIVvDpAPPUsQ60uBI+0BMCzU4OoLTTvgr1EceF7qUnprGBZAwcBoQO0aeT5td3JA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794977548; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=owJsBBfTcY32+grwyBsW4Ys1YOwRE9098kbEal4OQ/o=; b=qHKt2/4x62YdGYfxZm6UzAerVWdnqhGtq6fRuUS7xSluoW2PX4z8CEOYRH3uQc9t9Wnr GQppBlqThiZD7Y7meNcBapk/k96dGcHlUYxjL8oYK9nhAYiqviI0VP+RxXzcyspnN4to1 riO6lwfI5fSbSv19YRJzS62jek6vk/wo8Sw/dwbWZMIyjDrXpUz4qo1bAsdfUZ7hdyjGB Qf0+DXQXKwW6RRaIVrUTqb2nhP1sGfdWz1IaIAEvq8pb23ZvnHlwLCQai5PpqFuwGixHA a6Z+BenkXr4g8+rLzTmIL0pmI7ZpuoIl6d5bzyGBGJmoN3+oYCyN5ImRLNGJ5g3xFIg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=PSXEZ5qh; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EFB9606A33B; Wed, 18 Nov 2026 04:52:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=PSXEZ5qh X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.72 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794977547; b=a5Rn8f4xBi8/BNkGeXs8Eguu02vmg19uxCoB5/cb0VLBz/1cLOX+fpdXnrRbEr0/737w qjAEfGlueBFb7T8VOB0thpNbuufAZ4/VHna8Yw7Pr6HjCE+KvFEWPgXGBXxnh8MRc+d6D bdvClZHqbVFb/ECy1Dn+qSc3NwzSkIzW+pWNDX138YWhy4dsO29e240e6GiBuccV3kShq EcYPgO+dHFHtQI2Vw7gQxckM8etWihqce7Tm9cq/CFcMdCmPojZcfzCUuB4YL+dq4WAXh 7nd4cNUXtx1hfCjGM4SnpEEnXG6OVmcBMOL4Nf1os1lPZRBhKPGQoQDbKgBAFc7XkQw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794977547; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=owJsBBfTcY32+grwyBsW4Ys1YOwRE9098kbEal4OQ/o=; b=xn6/aLDv9Y3iZ30KlZfx8FwRuEDmGFs7N+T5qtt07WDPL25Hb1jXqzvRdoffIvLgtJbc UqKijxjrY/pCgmRXZZ+fVjpr971gcO72JuOQoqPhvprKJJJvNPnBpg5812xK3EB+8jzip Jif+ZYBVjYxuetdS7GWCUYQRqD24vZoBU/n/MDLbcaSQLsPtq1AqvteZWjf+DPWAw0/6k +9LhLYyVmaTzMXfK+Il7I37gVPE2vIBFBNLw03mGWWjLU7RLQJCVfNZs2Y4aIqlutzjY6 OINzOAtEzTRh089T4QPTDSO332OFYjJolNGcBY/IxC8pQS6l3vlNl822DNteenZ17Ow== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=PSXEZ5qh; arc=none smtp.remote-ip=91.218.175.72 X-Received: from mta0.migadu.com (out-72.mta0.migadu.com [91.218.175.72]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1430E606A325 for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 04:52:26 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1430E606A325 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=CxsJqg6NZ0rJSY+q+jjFAXoCxrwiTWX2Qt+1al6xkL4=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1794977545; v=1; x=1795582345; b=PSXEZ5qh2CPt4jhX1cxa2kYflDj2botNZiqNxXY6aXPyNo8bzvDmeyQUqLLHeNKt4kpaeTL9 7y6TeWyWkIzfDSS5Ntd18oDxwK4V6DkstAYP6ZX3rtumx6bXj11z/QU1dBhGhLQ+FDlkcFBcXKz sWsBznP/18kQbXLMe7L6PIFA= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id 77474746f915bd0c; Wed, 18 Nov 2026 04:52:25 +0000 X-Mizu-Trace-ID: 77474746f915bd0c X-Migadu-Flow: FLOW_OUT X-Cc: Jiayuan Chen <jiayuan.chen@linux.dev>, Simon Horman <horms@kernel.org>, 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>, Matthieu Baerts <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>, Geliang Tang <geliang@kernel.org>, Allison Henderson <achender@kernel.org>, "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, mptcp@lists.linux.dev, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-s390@vger.kernel.org X-Mailer: git-send-email 2.43.0 X-In-Reply-To: <20261118045137.174026-1-jiayuan.chen@linux.dev> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list