Article View: linux.kernel.netdev
Article #87Re: [PATCH ipsec] xfrm: espintcp: reorder operations within espintcp_init_sk
From: Steffen Klassert
Date: Wed, 07 Oct 2026 06:48
Date: Wed, 07 Oct 2026 06:48
61 lines
9383 bytes
9383 bytes
On Thu, Oct 01, 2026 at 12:55:11PM +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 ยท High: 1 ยท Medium: 0 ยท 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).
>
> - [High] The patch does not fully close the race it targets.
>
> --
>
> xfrm: espintcp: reorder operations within espintcp_init_sk
>
> This commit reorders espintcp_init_sk() so the espintcp_ctx is fully set
> up and published in icsk_ulp_data before the socket callbacks, sk_prot and
> socket ops are switched to the espintcp versions. It relies on the barrier
> in rcu_assign_pointer() so that callers always find a valid ctx.
>
> Link: https://lore.kernel.org/all/c30b645074a1b379e0f7fe297f917c66137d9964.1778464688.git.zylzyl2333@gmail.com/
> Link: https://lore.kernel.org/all/20260819155349.3555804-1-jjy600901@snu.ac.kr
>
> > diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
> > index 3e72b9f067b9..1087a8dd94f4 100644
> > --- a/net/xfrm/espintcp.c
> > +++ b/net/xfrm/espintcp.c
> > @@ -466,9 +466,23 @@ static int espintcp_init_sk(struct sock *sk)
>
> [ ... ]
>
> > + rcu_assign_pointer(icsk->icsk_ulp_data, ctx);
> > +
> > + sk->sk_data_ready = espintcp_data_ready;
> > + sk->sk_write_space = espintcp_write_space;
> > + sk->sk_destruct = espintcp_destruct;
> >
> > if (sk->sk_family == AF_INET) {
> > sk->sk_prot = &espintcp_prot;
>
> [Severity: High]
> Does rcu_assign_pointer() actually order the stores that come after it?
> The commit message says:
>
> "rely on the barrier provided by rcu_assign_pointer to ensure callers
> will have a struct espintcp_ctx available."
>
> rcu_assign_pointer() is smp_store_release(), and a release store only
> orders the accesses before it. The plain stores after it are not ordered
> after the publish. These are sk_data_ready, sk_write_space, sk_destruct,
> sk->sk_prot and sk->sk_socket->ops.
>
> On arm64, POWER or RISC-V these stores can become visible before
> icsk_ulp_data. On any architecture, the compiler is free to move them above
> the release store.
Sabrina, do you plan to update this one?
Technical Details
Message-ID:
<asXrPCMX747L5_tq@secunet.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342220-linux-kernel-netdev=dewy.ruReferences:
<dcb164e6a1064fcd32c2e72fd9ee918dd1427f15.1790617484.git.sd@queasysnail.net> <179085931198.434549.11976738723347461302@kernel.org>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-342220-linux-kernel-netdev=dewy.ru From: steffen.klassert@secunet.com (Steffen Klassert) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH ipsec] xfrm: espintcp: reorder operations within espintcp_init_sk Date: Wed, 7 Oct 2026 08:48:28 +0200 Organization: Usenet Network Message-ID: <asXrPCMX747L5_tq@secunet.com> References: <dcb164e6a1064fcd32c2e72fd9ee918dd1427f15.1790617484.git.sd@queasysnail.net> <179085931198.434549.11976738723347461302@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="593015"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Rdw7J01Z9GjNUnnPclIDTVT4o1Q= sha256:HNiwazyVgnXXoE9L9TtKyNoR4FIXvA9gGAPqdk+oVmo= sha1:1VG+ksZ3aqkMGjlFSrCH//zCOXU= sha256:70Djh2OzJBhkcauPw73uYhHearwiukjw+PVhmvQ12fQ= Content-Disposition: inline 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 2409410F0F5; Wed, 7 Oct 2026 09:48:55 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=secunet.com 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 Sx7drkRNUX7K; Wed, 7 Oct 2026 09:48:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-342220-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=secunet.com X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id ED81D10F0E6; Wed, 7 Oct 2026 09:48:47 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id 59C5225F98; Wed, 7 Oct 2026 06:48:44 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C506E3FCB11; Wed, 7 Oct 2026 06:48:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="Ez55cBrD" X-Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0787C547076; Wed, 7 Oct 2026 06:48:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791355721; cv=none; b=q79naEgOCU4YWL+EVrqV7uR9rqlO0EECkuqmBqRTgqCWnyLSrpCsRW4Y9ioDdWjsn4k+rXvu93QdDxdUsHL8Mszs5VzKgLVk2fOyuImkUVwbua5+nzakBDulqQVG3ZDBtr4GPMfZrvqtBSg/xpH/uHq33UcFace4KYKCs4FVgw8= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791355721; c=relaxed/simple; bh=R1PBjr/KTJ4iL34W94AE3eV5wrZGeENrOBlhRuNyMUs=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=H33HCCTYnhTA0RAqNKvuBFMZqb4S1e6n8lR4Cf3DGr/a2hBV8miKmOu/oXy+84pjnJ9B29XMR4pYugqoSARW2mITsi1jY0jCdK2JgsvDpvXWfvYCbT/9tRu/JJ0rcgJ8jFtds5AUAeSGW5Vz4GSZ99N1RiE9Fz4eN4gNsXierAg= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=Ez55cBrD; arc=none smtp.client-ip=62.96.220.36 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com X-Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 3D30020844; Wed, 7 Oct 2026 08:48:30 +0200 (CEST) X-Virus-Scanned: by secunet X-Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v1BBXX8DiA9i; Wed, 7 Oct 2026 08:48:29 +0200 (CEST) X-Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 487D62074F; Wed, 7 Oct 2026 08:48:29 +0200 (CEST) X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 487D62074F X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1791355709; bh=wNWl6+bQFVTpmYCTe0SWoj24ZSXLF9U7TB+h9CNRmv0=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=Ez55cBrDJsz29jfC2HMqZ5zUgZdCUivl4clMhYSLgilYfjbzOTNpaiG2DtCsjtH2F zMIuANTz7nTUjg5ltlE5PoyZCZijo7h7E2urfAV07mjplpy3nK+oL+i/a26oYZDsvw nc/D+NqUeTMLTv1GvdnfcbAEdX6Vq9cjtjIQFZ8vJqZSH52b/hCCDcFCamYenF6q5K jYv4aWYGThSAvquWRe4wJ7Is3fbwfSvBjvcTQbAelj9AbMfytPHdqq0T1ugsYEZX4r cVbzzHhJc3qkKKUxWCjePo5ByBHPiFvSYVuDEtHUrzyZsB6KennFaFeOzRgIQy+0jS Z5gxQ93FVTx0A== X-Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Wed, 7 Oct 2026 08:48:28 +0200 X-Received: (nullmailer pid 3303040 invoked by uid 1000); Wed, 07 Oct 2026 06:48:28 -0000 X-CC: <sd@queasysnail.net>, <netdev@vger.kernel.org>, <herbert@gondor.apana.org.au>, <stable@vger.kernel.org>, <yuantan098@gmail.com>, <yifanwucs@gmail.com>, <tomapufckgml@gmail.com>, <bird@lzu.edu.cn>, <ronbogo@outlook.com>, <zylzyl2333@gmail.com>, <n05ec@lzu.edu.cn>, <eulgyukim@snu.ac.kr>, <jjy600901@snu.ac.kr>, <kuba@kernel.org> X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-In-Reply-To: <179085931198.434549.11976738723347461302@kernel.org> X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de (10.32.0.171)