🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6110

Re: [PATCH bpf] bpf, sockmap: use READ_ONCE/WRITE_ONCE for saved_data_ready in the verdict path

#6110
From: bot+bpf-ci
Date: Wed, 21 Oct 2026 16:37
59 lines
10318 bytes
--===============7309015236229723418==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

> bpf, sockmap: use READ_ONCE/WRITE_ONCE for saved_data_ready in the verdict path

TL;DR: Commit message only: the Fixes: tag may point at the wrong commit;
5a685cd94b21 may be the better target (medium confidence), though 2ef2b20cf4e0
may be deliberate for stable backporting. The code change itself is not
criticized.

> bpf, sockmap: use READ_ONCE/WRITE_ONCE for saved_data_ready in the verdict path
>
>     sk_psock_start_verdict() and sk_psock_stop_verdict() access
>     psock->saved_data_ready with plain loads and stores, while the sibling
>     sk_psock_stop_strp() uses WRITE_ONCE for the same field.  sock_map_link()
>     / sock_map_unref() touch the same psock from another CPU without the
>     lock, so KCSAN reports the race:
>
>       BUG: KCSAN: data-race in sock_map_link / sock_map_unref
>       BUG: KCSAN: data-race in sk_psock_start_verdict / sock_map_unref
>
>     Use READ_ONCE() for the reads and WRITE_ONCE() for the writes, matching
>     the strp sibling.
>
>     Fixes: 2ef2b20cf4e0 ("net: annotate data-races around sk->sk_{data_ready,write_space}")
>     Assisted-by: LLM
>     Signed-off-by: Dudu Lu <phx0fer@gmail.com>

Is the Fixes: tag pointing at the right commit?

2ef2b20cf4e0 only annotated the sk->sk_data_ready and sk->sk_write_space
accesses, plus the saved_data_ready store in sk_psock_stop_strp().  Its
parent already had plain loads and stores of psock->saved_data_ready in
sk_psock_start_verdict() and sk_psock_stop_verdict(), so it left the verdict
path unannotated rather than introducing the accesses changed here.

The psock->saved_data_ready field, and the lockless reads of it that the
KCSAN reports are about, came from 5a685cd94b21 ("skmsg: Get rid of struct
sk_psock_parser"), which folded parser.saved_data_ready and parser.enabled
into psock->saved_data_ready.  Should the tag be:

  Fixes: 5a685cd94b21 ("skmsg: Get rid of struct sk_psock_parser")

The verdict start/stop code itself dates back to ef5659280eb1, but there the
unlocked reader tested parser.enabled rather than saved_data_ready, so this
attribution is a medium confidence suggestion.  It is also possible that
2ef2b20cf4e0 was chosen deliberately, since the context lines of this patch
depend on it for stable backporting.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/39631503837
--===============7309015236229723418==--
Technical Details
Message-ID: <053c6a0f6e94a626bf00b3a32ce9bcf7eaf89014b45c210ef3331e88b946d808@mail.kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350151-linux-kernel-netdev=dewy.ru
References: <20261021155629.68813-1-phx0fer@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350151-linux-kernel-netdev=dewy.ru
From: bot+bpf-ci@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH bpf] bpf, sockmap: use READ_ONCE/WRITE_ONCE for saved_data_ready in the verdict path
Date: Wed, 21 Oct 2026 16:37:09 +0000 (UTC)
Organization: Usenet Network
Message-ID: <053c6a0f6e94a626bf00b3a32ce9bcf7eaf89014b45c210ef3331e88b946d808@mail.kernel.org>
References: <20261021155629.68813-1-phx0fer@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============7309015236229723418=="
Injection-Info: usenet.network;
	logging-data="6241"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FqSRLk3cihsfxd4NOA6YEthwlJ0= sha256:bnPEwGmSalBZlDqtuZVGFtxbQiYo8kef9W1mAPyE8xI=
	sha1:Le6d15EXfixKgOgYGE0RPodZxkc= sha256:Qo0gXfgU7QXD9LwlOx2kCxt3AXP/hOUN4qjQODEvBqE=
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 A4968111098; Wed, 21 Oct 2026 19:38:00 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, 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 f90SlLWO5dxV;
	Wed, 21 Oct 2026 19:37:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-350151-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id B57BC111036; Wed, 21 Oct 2026 19:37:48 +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 C2E8760A622; Wed, 21 Oct 2026 16:37:26 +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=1792600636;
	b=1rXz5sOvHVQKzuJXUC3J0757rUudMX7wNhMpMO/v3jUAMslITcmQPXsvqN8h9zfqMZXM
	 iRC9eodKm48ihtVlUKPgh7KHiY6WpTa92BuHbVgp1n24ImXDKkvNT4gao0YOjH8dJPENh
	 qt99YhR3J8JBS3+Kg3vgkDbPsgARxKwnRxPkaBaL2xrXEnx7vgFWCMFvapciRMTnlgJKK
	 MD6z2jcZh4r6gAezK/0giVjfThhR+i45VdjjNXUhlfFSwoDiZHtcwVkWetQNJkZjIozob
	 TwtyDYEJD/CkD1GIJMM3mfSPZcgTSbPlGwSG/eN411ObXP86Fh64H78GchzTB/bxltw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792600636;
	h=X-Original-To:Received:Received:DKIM-Signature:Content-Type:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=3I9FF88P2q7bt1FMGLPxScdGviwzl5MeRLq/bpUR0iU=;
	b=xI1m/lTzuxqYGCmshxAiGQ6BQoNG6056S2k3ZdUVKNUYl0EUdc66V1Oj69W9/vnOnZ6T
	 LD/DWJBfEKF5TlxmydtRzmZoOksu+VhwvW5bRE2DfnxCHhsVDeVT1HL0QmBgbTmniyNp/
	 KJWEr1Y870SypaZPtwahasPRlr+8XBwX3hd9XCLMJXjgrJErcoMSsM2jeQ+bYnOtaRV7e
	 0NicIBkOHL87qFCAK/1OoTaiSSfQbx/C3B1CnRBmXZcwCu6us/G+1Wk+Xy3KK1XTONe5l
	 7b05z7obNhPWIJ4nYn4HsOEhabe9LLiuAJ6VT0POOdh3CKWv39pb/1jStgIXQsM0PRg==
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=EV0YWUtz;
	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 194AF606A332;
	Wed, 21 Oct 2026 16:37:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EV0YWUtz
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=1792600630;
	b=rcnOWnxgZXANOZtRjo+gH7qbv/SmnROz0MaUDR7wYoUw3Oq6B58dKDUCmFJ+Y1chIj1E
	 YrV6XdQ0xXz25osocLrbqvfbGtDlhcSXGW6+e7A6CDy9LA/GpPql/ZMRH7w8ExjMxwJog
	 9VOXR61TdZ7RAgHMft8hy80okLtVou1szJ2uCuB0GeSKmoAUf6u0b1LlHIp8q79mKjiJx
	 zTdNXqQ1+0SBsN1gOynJD+RA/C7xoU1wuKirCeIs74ImIeCwejCLN0xnOhAchvol9XnWo
	 u27SXnIzNHfK8bSYeLpUggG2PDWC1VbnrU5z+drffwnYsrt9/VGKPWOsqIEhPuunQAg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792600630;
	h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=3I9FF88P2q7bt1FMGLPxScdGviwzl5MeRLq/bpUR0iU=;
	b=vVhG1pVhX6HruPB8yMcrhas0wcFu0ZygncW1grlAYr33vzfMnDl7UEc5iZlhpppj/O85
	 4UvwYPASceToqFQDDJeFNulb2GbGpGRyWVv6UGGrTdDdn9rOIAMaPBTwJBfaTOcDgIq7O
	 yPEydIrCaXgNo79PYbZf7kll30JLhaZA0dZG8ARrK+cgoUpe4T6EnyEJz6FQKAA7kI+hC
	 rj0d4fBoOa2Wn/gd8fM9/KRy6yPs86px5z/vsxlkZumDOrGFiAX5hN5w75ZFywcJ1IOvx
	 FQf+1GIvGkUU78Hbk3TWJBtiFbZqErKWc1WqPWdGYk04snk9Q7T6pmhszfGbmn89qbg==
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=EV0YWUtz;
	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 EE03C606A32A;
	Wed, 21 Oct 2026 16:37:09 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AAF81F000C1;
	Wed, 21 Oct 2026 16:37:09 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792600629;
	bh=3I9FF88P2q7bt1FMGLPxScdGviwzl5MeRLq/bpUR0iU=;
	h=In-Reply-To:References:Subject:From:To:Cc:Date;
	b=EV0YWUtzTsJQey2htZ0GwJVEAPswNk5/OQBMqAFQcibn95fREK3Av99qz3MNz72/W
	 qb4+t8ADrL8E80QqTWQB+9GPbz6Ax4wAVdVEYhwx4nv2Onv7vcv0126DULLFrDeyh6
	 0/TelodcvVA8EFF6UWPNiYI2WWJx0MnKIrzlTOdZJ4XgPkJ+oOwLPwsrzPCqzwJPOb
	 OmsBN6oQ2DH3DW2TaFqtbLLxnqZlIp59NDCbvZtBB5csTXGszC1vd0ARNWSBI3zB+g
	 kPgumQXgcD0G8XpFdedLq3oQ70fbZbfuSK4cMIV0tYwKWYMTl2lu6f9wVN8Pl4ich0
	 iSnK+S3etKxkg==
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
X-In-Reply-To: <20261021155629.68813-1-phx0fer@gmail.com>
X-Cc: netdev@vger.kernel.org,bpf@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev