From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796375721; b=3sCFS9NVJ+LW/7fDfZD3lITjAJLxX+tOEfRABICDWcdYwBJFirOn3XCCNjxAyNSmWxUN Pi7XbRga9+yf4RP2MGKm1pc/P4/kswLMjTmNZZpeSj+ClTXAxPMhUdEFZONJCxDlJn5qw PHD8GOP/E+cYYLrodk5S7pesz0PJKiAXXsiutEOMV5ADq1vv6InnO8/5eL/LUgMdl6WLY U6BX9YUkE0JTJ0ohWgj+HX8oYbp57b+7FRCAz5eA9BIhF6MJmfx42NiKr+AaLwLEZ2Z/f uO8mRff5vU51uIJBlY/ZtVD463BLtoMCs/alozxOXpSUHEgrNmw54cCT2XnKARxaxkw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796375721; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=n1xkm6PuDsw0qWDFNaxf3W4NWmHHQtgrDDPzTB6fh4Y=; b=bWy/NFZzRfkEnUsrskFZk80WAXh9dff4JJju+yKKwgP0vIuFsrwZ8qmtCeROFarCF9Wz skz9I7v5uA10UjVm6tfam5AZbp2dKXZx5ZobaDVjkAfPMbo11spDN8K/OJIzHmWsRJZaC JZuGN35bJk3lHRRpBi/w7ZnEfWOHbN71wA8PMm8L71Kylt3agHI2vYs2+SiPltrV04zzp w9mZZ62lOUh4HLIwu0HjKRQlCkI+/5wGLpqVjvSR8sprfQC1KYelv3189wWguFXeyrDdJ wgzFHa1dcH8gRvYVPssejg0LM4VB/xdDHBXDqgf4kWdKplX3mMZT618b8FBdCqcH/UA== 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=Scnth0VH; arc=none smtp.remote-ip=100.103.45.18 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 C4434606A338; Fri, 4 Dec 2026 09:15:21 +0000 (UTC) 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=Scnth0VH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B1991F0092C; Fri, 4 Dec 2026 09:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796375721; bh=n1xkm6PuDsw0qWDFNaxf3W4NWmHHQtgrDDPzTB6fh4Y=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Scnth0VH5RW1cU+UCmUhsc9qI2lOQO2cX29pLy7cKNeXgMbzf32Hy9IofFvicF2W0 l6BYqmj4JGa4ZkGUGD9a6u2dzUlYtok5nrgjNlojrohuZvjzsTUcYj2u0JdDS+jvQQ eU+BV7ItJm2KPn5g9IG6GY+dfPjNTOEJ/6/lGK5HAojgm7ApCebN3qKUCXzsHUXL3W u6m5eou3ppl/hNn/ZlvRCeUaL0OfAqyb+lS4vvjqmzc56r65Flo3Rsak9EQGfW09Pk 6j/n/7wkcv7OBokukZhvauTmTTltdimFGbyCH/xHKk+K3T92NwuV1QRYuBoBng8IDw oPnvacsjl7sEQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net v3 5/7] net/smc: order the urgent mark across the cursor wrap rollover Reply-To: sashiko-reviews@lists.linux.dev To: "Bryam Vargas" Cc: linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261203-b4-disp-ba1ad55e-v3-5-6834ff90c5d0@proton.me> References: <20261203-b4-disp-ba1ad55e-v3-0-6834ff90c5d0@proton.me> <20261203-b4-disp-ba1ad55e-v3-5-6834ff90c5d0@proton.me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:15:21 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] net/smc: race between urg_curs copy and urg_state check in smc_ioctl() -- commit f0a9404787457616babe9aded75f7a3fe0de2944 Author: Bryam Vargas net/smc: order the urgent mark across the cursor wrap rollover This commit replaces urgent-mark cursor comparisons in smc_rx_update_consumer(), smc_rx_recv_urg(), and smc_ioctl() with smc_curs_sdiff() to handle the 16-bit wrap rollover, removes smc_curs_comp(), and gates SIOCATMARK on urg_state or urg_rx_skip_pend. > diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c > index bfc0c7e71a12b..3877a3a4cbae0 100644 > --- a/net/smc/af_smc.c > +++ b/net/smc/af_smc.c > @@ -3277,8 +3277,10 @@ int smc_ioctl(struct socket *sock, unsigned int cm= d, > } else { > smc_curs_copy(&cons, &conn->local_tx_ctrl.cons, conn); > smc_curs_copy(&urg, &conn->urg_curs, conn); > - answ =3D smc_curs_diff(conn->rmb_desc->len, > - &cons, &urg) =3D=3D 1; > + answ =3D (conn->urg_state =3D=3D SMC_URG_VALID || > + conn->urg_rx_skip_pend) && > + smc_curs_sdiff(conn->rmb_desc->len, > + &cons, &urg) =3D=3D 1; > } > break; > default: [Severity: Medium] Can SIOCATMARK race with smc_cdc_handle_urg_data_arrival() and test conn->urg_state against a stale copy of conn->urg_curs? smc_ioctl() holds lock_sock(&smc->sk), whereas smc_cdc_msg_recv() runs in tasklet context under bh_lock_sock(&smc->sk) without checking sock_owned_by_user(&smc->sk), so the two execute concurrently: CPU0 (smc_ioctl) CPU1 (tasklet: smc_cdc_msg_recv) lock_sock(&smc->sk) smc_curs_copy(&cons, ...) smc_curs_copy(&urg, &conn->urg_curs) bh_lock_sock(&smc->sk) ... smc_cdc_handle_urg_data_arrival() smc_curs_copy(&conn->urg_curs, ...) conn->urg_state =3D SMC_URG_VALID bh_unlock_sock(&smc->sk) conn->urg_state =3D=3D SMC_URG_VALID smc_curs_sdiff(..., &cons, &urg) <-- compares against stale urg_curs If cons is one byte before the wrap rollover (wrap 65535, count rmb_desc->len - 1) on a connection with stale urg_curs {0, 0}, and a new urgent byte arrives further ahead between the copy and the state check, SIOCATMARK sees SMC_URG_VALID and falsely returns 1 to userspace. Protecting the urg_state check and urg_curs copy with local_bh_disable() and bh_lock_sock(&smc->sk) would keep them consistent. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-b4-disp-ba= 1ad55e-v3-0-6834ff90c5d0@proton.me?part=3D5