Article View: linux.kernel.netdev
Article #8907Re: [PATCH bpf-next 2/2] bpf, sockmap: Fix psock update-side data races on sk->sk_prot and progs
From: bot+bpf-ci
Date: Fri, 30 Oct 2026 12:45
Date: Fri, 30 Oct 2026 12:45
77 lines
11176 bytes
11176 bytes
--===============5168075361254505390==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
> bpf, sockmap: Fix psock update-side data races on sk->sk_prot and progs
TL;DR: Commit message only: the first bullet says the saved_data_ready gating
was dropped in sock_map_link(), but the diff drops it in sock_map_del_link(),
duplicating the second bullet.
> bpf, sockmap: Fix psock update-side data races on sk->sk_prot and progs
>
> The update side of the sockmap psock lifecycle has several unsynchronized
> accesses to sk->sk_prot and psock prog state that KCSAN flags when the
> new update-vs-delete race selftest runs. The fix comes from Alexei [1]:
>
> * sock_map_link() installed psock programs and called sock_map_init_proto()
> before taking sk->sk_callback_lock, racing a concurrent teardown's
> tcp_bpf_update_proto() write of sk->sk_prot. Take the write_lock early,
> before psock_set_prog() and sock_map_init_proto(), and drop the
> psock->saved_data_ready gating from prog detection (it is re-checked
> under the lock before stopping progs).
>
> * sock_map_del_link() read psock->saved_data_ready outside the lock. Move
> the saved_data_ready check under write_lock_bh(&sk->sk_callback_lock)
> so prog teardown is serialized against the proto restore.
>
> * sock_map_psock_get_checked() and sock_map_sk_is_suitable() did plain
> sk->sk_prot reads. Convert to READ_ONCE() to mark the intentional racy
> read against the WRITE_ONCE() swap in sock_replace_proto().
>
> With these changes the sock_map_link/psock_set_prog side of the reported
> KCSAN splats is silenced; the remaining teardown-vs-core-TCP pairings
> are the separate read-side annotation problem.
>
> [1] https://lore.kernel.org/bpf/DMBHB0TQOV1L.38MECMYFGUS5B@gmail.com
>
> Suggested-by: Alexei Starovoitov <ast@kernel.org>
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
The first bullet says sock_map_link() drops the psock->saved_data_ready
gating from prog detection, which is "re-checked under the lock before
stopping progs". Is that sentence describing the right function?
The diff doesn't change sock_map_link() that way. Its only change is
moving write_lock_bh(&sk->sk_callback_lock) above the psock_set_prog()
calls, plus the matching unlock on the sock_map_init_proto() error path.
sock_map_link() still gates on !psock->saved_data_ready:
if (stream_parser && stream_verdict && !psock->saved_data_ready) {
The gating that was dropped is in sock_map_del_link():
- if (psock->saved_data_ready && progs->stream_parser)
+ if (progs->stream_parser)
strp_stop = true;
...
+ write_lock_bh(&sk->sk_callback_lock);
+ if (psock->saved_data_ready) {
The second bullet already covers the sock_map_del_link() lock and
saved_data_ready change, so the sentence in the first bullet looks both
misplaced and repeated.
Could it be moved to (or merged with) the sock_map_del_link() bullet, so
that a reader doesn't conclude the saved_data_ready checks were removed
from sock_map_link()?
---
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/41053761520
--===============5168075361254505390==--
Technical Details
Message-ID:
<f8deb60a9defc57ab66786255fb2e397696c9dc9a86b2c320c63494a38e97e9e@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-353766-linux-kernel-netdev=dewy.ruReferences:
<20261030-bpf-next-v1-2-035eabf8eae7@cloudflare.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-353766-linux-kernel-netdev=dewy.ru From: bot+bpf-ci@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH bpf-next 2/2] bpf, sockmap: Fix psock update-side data races on sk->sk_prot and progs Date: Fri, 30 Oct 2026 12:45:49 +0000 (UTC) Organization: Usenet Network Message-ID: <f8deb60a9defc57ab66786255fb2e397696c9dc9a86b2c320c63494a38e97e9e@mail.kernel.org> References: <20261030-bpf-next-v1-2-035eabf8eae7@cloudflare.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5168075361254505390==" Injection-Info: usenet.network; logging-data="2236552"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:sMPZXu+xBOELAyG+FDvwpX2WJVA= sha256:Ol9UF26uQwau5WhqyGeVHFN3TXsnV1RvRzkvHCR+GE4= sha1:3SNGwINsf1P3VDn2sB9APtmioQ8= sha256:3cFT67Ml7IGP5Ux8wdeCc6nU+lBRX6zSBtWBsgY2S34= 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 E4B03125C94; Fri, 30 Oct 2026 15:50:35 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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 MMzBMFDDfWJ1; Fri, 30 Oct 2026 15:50:33 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353766-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 44368125C93; Fri, 30 Oct 2026 15:50:24 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 67B012DBF1; Fri, 30 Oct 2026 12:45:51 +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=1793364351; b=V90AXZtJJOyJpo1GbF+p83yW0eUI2Uzig3GowWNTUgLa/jJQsEFU+euw6ZHrMZqgzc91 WfAnhcOXG3L9W3NGmg13gReqmZ/gDAjJdRPopnSuzEJ5Fl+ivlz3WaCgTdDVF2lgNO16d fzFs2b/BWYdc9DEbi9u6SfSUbyjldl9Nq/xf0Oohcbpy2zhaMLP8SE3KTpzvFIz1oCIkK Up1UiqZ1NOL2kFN5YBapYVmdQefIv1H1zfbSRWJUx3CqcNtjVtaSyo4oq5yIbaZlYNyID 8h4KMO5wB/ycap0AZzvmLgd7qNyLG3Mhg3ocaphQpAtxUlrUp85HC9x3cRPsv06ClMA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793364351; 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=jE/d881YY3SoJyzXgCRntoSX9ott7YhMKwZ2jO4IBRU=; b=hccDUweMbLxUY51qrwrhw8ZL4cVDKa/0ThXtI0mwwOgyFJw9WIPKYoRaT8Xf7eCTZN20 hWCRsd33W4/t28PdN3/5/F0wRgXb6d1XMLZ53JmJObA3qhg58NvWt6e79B1MuqXky1+Kq Hqy8a0apz+3c7rwtG2yqUn7RXiFS8YsHTJYCHmYXNgChg7RnXpQyXQICvzHygbqIkWZHF fwoWgNJ9St04NK0yoampwBWuNmsMvI/5CpOl4hHqclYKbAnKTtsyKGvmj+XBqqa8w4bNr jG9W28E0veh8OiEC9L27jgxSNYFZQv+tFqvzu6opDtY3icSX4Gqhyy9TaYIIH3//JzA== 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=nzfRmEHi; 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 40075606A323; Fri, 30 Oct 2026 12:45:51 +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=nzfRmEHi 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=1793364350; b=bo4vjWjfOEFZpL0MZ8HpNRRUG3/zI/zHJe6XmeQQ361163ddW+SdYqX2iRvdbUcpE4WJ HkwwCS2aND0qM0xZzXe6eC2xOMuKZFtX/oPGsBD/8aoQUkm0e2OcovhxULbdsX4PV3Ci1 0Uiyy7qXu1vUzB+pJ/GqrUVg7i0lGFQVUNENgvOuuH7GgNri30HX3paGVCuJw+yXTe2w+ CnUO4tTHmskHnxdsuHq/JNHId2t4ds5xZOKWJq+QhVhzDV2ePvEqPYH/85oYI+/q8nzT5 64GKo6vBojZcEl/YEKhg6kNM4v0sCBxjsazRsudQA9brIReZFNLnDNpJGLYW4I14rMw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793364350; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=jE/d881YY3SoJyzXgCRntoSX9ott7YhMKwZ2jO4IBRU=; b=Yt+filxz69yott8R9GHMYgsNlLH7kW8rV8jmW9luj7j98j2MqQUcuJuC7ovXz0C+tkuA XG/ULIm9kghaiRNXI3LbhA3UOtmZX9W1AUffnHZitahG9FKRdywLZo0gPC2cxQp32uNRs x/twdaEdZrq5oMQ6NbeXaz1hTR5xO2UBYVe4qqaG6iNLQHXHuCeRzdw8063sz4wlwJUZ2 9prkJe04sziLE5f8uHau8zTRmJd/G2L8MEyKhvY/JMC5vXZvzkVSSj4OT8QLmx29npK0d YzUQb6lbReOUQpiomwbVsejLyyqBThWFGrqoearJGwr4iuQnKqa7WmmC7dk7fyABkCQ== 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=nzfRmEHi; 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 1E8AD606A31C; Fri, 30 Oct 2026 12:45:49 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 475B81F000C1; Fri, 30 Oct 2026 12:45:49 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793364349; bh=jE/d881YY3SoJyzXgCRntoSX9ott7YhMKwZ2jO4IBRU=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=nzfRmEHiobLc4xrnoJ4t4GXPrPD0PbnYHdsYvmgVg2naI96o4WGSzVdxI5xUqpF1X AWKDxgnYvjPkvA1nY1dvyNq74pYtKI6OIwViSOEF9DqozdMy/8YUmSzZLbqOFDOlr0 7F1uZJQnEQWNmI9dUbP6Oh+cWTMdzwGdub7nhcpYYWjtHV/PgoKa8ES8ODO4thG3Ev W8PaL6n+IDysX0W/DC/qxUzHF4QJ39et04cBO7g9eCr2RG2lxgQodQTF7ka8YWlrP6 X6+T3WoGxaGk1ujPQNBfcV9pXGCQAt3Flg/8a358KJXLR32LNx6pcTMlQAQRZlvWka gXHgALnrqw0zA== 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: <20261030-bpf-next-v1-2-035eabf8eae7@cloudflare.com> X-Cc: bpf@vger.kernel.org,netdev@vger.kernel.org,kernel-team@cloudflare.com,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