🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26542

Re: [PATCH net-next] net: use RCU_INIT_POINTER() to clear sk->sk_wq in sock_orphan()

#26542
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 18:05
77 lines
10792 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch carries `Closes:` for the syzbot bug titled "data-
  race in unix_release_sock / unix_write_space", but one of the access…

--

net: use RCU_INIT_POINTER() to clear sk->sk_wq in sock_orphan()

This patch changes the plain store that clears sk->sk_wq in sock_orphan()
to RCU_INIT_POINTER(), so the store is done with WRITE_ONCE(). The goal is
to silence a KCSAN data-race report between unix_release_sock() and
unix_write_space() that syzbot found.

Closes: https://syzkaller.appspot.com/bug?extid=c2e012bd497ee37068b0

> diff --git a/include/net/sock.h b/include/net/sock.h
> index 5a203809218aa..9d22ccd91838d 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -2168,7 +2168,7 @@ static inline void sock_orphan(struct sock *sk)
>  	write_lock_bh(&sk->sk_callback_lock);
>  	sock_set_flag(sk, SOCK_DEAD);

[Severity: Medium]
Will the syzbot bug in the Closes: tag still be reported after this patch?

sock_set_flag() is a plain non-atomic read-modify-write of the whole
sk_flags word:

include/net/sock.h:sock_set_flag() {
	__set_bit(flag, &sk->sk_flags);
}

On the peer side, the skb free path reads the same word without holding
sk_callback_lock:

unix_release_sock()->kfree_skb_reason()->unix_wfree()->sock_wfree()
  ->unix_write_space()->sk_wake_async_rcu()

include/net/sock.h:sk_wake_async_rcu() {
	if (unlikely(sock_flag(sk, SOCK_FASYNC)))
		sock_wake_async(rcu_dereference(sk->sk_wq), how, band);
}

unix_write_space() only holds rcu_read_lock(), so no lock is shared with
sock_orphan(). KCSAN can still report this pair under the same title,
"data-race in unix_release_sock / unix_write_space".

The notes below the changelog say this pair shows up in 3 of the 35 syzbot
crashes and in 3 of 5 local runs with the patch applied. Once this is
merged, syzbot would close the bug and then report it again from the same
reproducer.

Should the sk_flags access be handled too? One option is an atomic
set_bit() for SOCK_DEAD in sock_orphan(). Another is data_race() on the
reader side. If that is out of scope, could the Closes: tag be changed so
it does not claim the whole syzbot report is fixed?

>  	sk_set_socket(sk, NULL);
> -	sk->sk_wq  = NULL;
> +	RCU_INIT_POINTER(sk->sk_wq, NULL);
>  	write_unlock_bh(&sk->sk_callback_lock);
>  }

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202180315.4144359-1-zhangjiayi1014%40gmail.com
Technical Details
Message-ID: <179632111980.3146.9699155298810510139@kernel.org>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376808-linux-kernel-netdev=dewy.ru
References: <20261202180315.4144359-1-zhangjiayi1014@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376808-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net: use RCU_INIT_POINTER() to clear sk->sk_wq
 in sock_orphan()
Date: Thu, 03 Dec 2026 18:05:19 +0000
Organization: Usenet Network
Message-ID: <179632111980.3146.9699155298810510139@kernel.org>
References: <20261202180315.4144359-1-zhangjiayi1014@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2561394"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:KC0FXwIEA1qNVlbx+sZZazjQcYo= sha256:olPO/RxVvr9x+9HlpuJEsXAL1EyfPepwI+60/vBFo1U=
	sha1:+jPZOYYvKSSYFPa747ATCVZ3ULo= sha256:Ka4XYnmTrHXDuOUMuAKTQJ2Grbv3xCThbWR0XMcKWPc=
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 AC87B117A00; Thu,  3 Dec 2026 21:05:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.74
X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.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 (2048-bit key)
	header.d=kernel.org
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 FJ0xpCHVxN28;
	Thu,  3 Dec 2026 21:05:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376808-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 426AF1179F7; Thu,  3 Dec 2026 21:05:26 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 259F325B62; Thu,  3 Dec 2026 18:05:23 +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=1796321121;
	b=O09aF+6+iTCvc1KzOpL9iU6U6JvO0woLHRiZ9ud+TlKRbJI0dJqAahQAb4OgkRC+kB67
	 kjsgrmKxvPobiXAzo21PCNyuSIXkeTj2tlkKBbV4/TVJnUTHdQAMLDDQji3vw5Z8TNm09
	 diXaBPfUbtJedbgPB9PoKh6i7A9cINB0wfGCWo0i/fBwAYBQed/0jxcPT6iclQFKrG4be
	 6r+nDQU91H+1+9ZN8hx4u8PS09chQ0NTzj6JWpusroBoSyKt9mrC7/CU1zdukeBiCEdkd
	 DTpwAeYtk6OuG250LJvSR/EraRCA/HHoO7Uz68j7ftlDVwUk4lUkg27VC1HUVOwvecQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796321121;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=c3UvURX5MeuJjDH84GfMDug/g7KmOW+9E0gpNuE1AuA=;
	b=XoCZxlHWDOrEnv19bb/q2v//92vAbD04JyC0BMUEponSAlQPi0o/kG71dtNUdJTm/2Nx
	 vl4mudwHgGGYk78aQfhEJHuP+ibfkROjhGjOdcSx1nH/zWbmZGJ5jMIuD7johUiU6VDz7
	 msY6Yic/l5iULH8IhHVGorTuskHwePNLeOUvJMmTVr2WHAQKXVdTOpsCl7MR+epMa6Iq4
	 SIiZBUvCWnxp4RBP0ouwRrGlafSahbKhUgrBPLuOit7PgXDAQ0YIyaxwqtrrJfQ2CBPDw
	 EMycAD/JJoKY67+0FKaR/ofcMjLnHKD2Ch27KG2BoKeFOAPcIoec6ZkqgYrUJelgtSg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KgoeJnoE;
	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 D99AC606A334;
	Thu,  3 Dec 2026 18:05:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KgoeJnoE
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796321121;
	b=jxi49jhWEInxz3ZNl44a2ywpPoWCFJ6t9ZFgXS76YOzfr/AC1sULs9SSN6Y8CEAPIMk7
	 lbWZXRDvft9d0q1a5OPoD55nPpDrgHl6aekSlfDwir2YmCjyU7O/9+h6eswTs2CRbR2Be
	 h0Eb50etRx84cF6d+9/Sstdj/jfvnA8OE1AOao/x/xcYz4ACptTcXBZQI/ZugUWS6+qLY
	 zGBF2qYwIvF6dubGzhJz5lxTpgSCO3L7o8PZpUpdnpgSXd1vNFIW9wbPM8l2G6dWg4SrH
	 Bnqri7GCS7YqfCuhK19phLHZneJL1r9XdQ8g2fzz6VG3NqBvbFm1F0p9gMYfKueb0Cg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796321121;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=c3UvURX5MeuJjDH84GfMDug/g7KmOW+9E0gpNuE1AuA=;
	b=AOWpvW8STWJQPRQeA/KkYl1uR7+qKo3MPSiAvuSrT8IgkVzXbZudIUtUa1gHhS8iZQ0l
	 aZEovj9TjZBHla6gKh62c1Hmf/Q8k2dhIt6JrFHgn6U8k9D6XfiycFGuV4nUAME6imAxH
	 5P8Qes3Oaff5Q9m6RXPWOf5mrrJIQGBCPJbsHmVj/9HVoJlqXuL/id1R9KOlTKH6OCIYr
	 AAismVI7NW9hauMZR2iyAgLwt0Q7N2bFMHp06yYKJmw5/7KWMa2cMq+RioLoyLz8rdCMr
	 bp5Dy+WHdvIqC/aZy9Ku7E0CBBbW9/0avXLCyzvDpWrFeiOHvCtG7BcBEscP0Rtm0pQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KgoeJnoE;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07A2F606A322
	for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 18:05:21 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4622D1F0089B;
	Thu,  3 Dec 2026 18:05:20 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796321120;
	bh=c3UvURX5MeuJjDH84GfMDug/g7KmOW+9E0gpNuE1AuA=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=KgoeJnoEyHVM/ezKAi7dT39AVsukLfmGcO3he0kPA7p/rnAqGAXVqZlCuH7QMclif
	 vZkZ4YMu+KAmVj5wXZO8NKncJ+Tuc1op0AAEmIdbkVirqUKp1C/3sIDT4tM/QaxjzS
	 iVkNTvDO1r+6598fbghb0KyyepGNl/BMTrlQddwP618OBDpAp7W5pqhVnJktmmO6OD
	 M0idqAihARle4zqTO7TcDqhGA19NAynFXqNn2CnmCutZF2tNwsMhBUnMe4uANJx5UQ
	 hYgL5hwAm//OrTzLqZwQ6CcDERY5UIx/a2e/WlUobHejPhz9OdLoYINpnyGq9HBouU
	 dae8cEC4VphVA==
X-Cc: edumazet@kernel.org, kuniyu@google.com, pabeni@redhat.com,
 willemb@google.com, davem@davemloft.net, kuba@kernel.org, horms@kernel.org,
 netdev@vger.kernel.org, syzbot+c2e012bd497ee37068b0@syzkaller.appspotmail.com,
 syzkaller-bugs@googlegroups.com
X-In-Reply-To: <20261202180315.4144359-1-zhangjiayi1014@gmail.com>
X-sashiko-severity: Medium
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