Article View: linux.kernel.netdev
Article #26690[PATCH RFC net v5 03/10] net/iucv: fail sendmsg() with EPIPE once sending is shut down
From: Bryam Vargas via B4 Relay
Date: Fri, 04 Dec 2026 03:02
Date: Fri, 04 Dec 2026 03:02
71 lines
13502 bytes
13502 bytes
From: Bryam Vargas <hexlabsecurity@proton.me>
sendmsg() tests SEND_SHUTDOWN on entry only, then waits for the peer's
window without the socket lock. When sending is shut down during that
wait, by shutdown(SHUT_WR) in another thread or by the peer's quiesce
over z/VM, the wait does not end and the call does not fail: the writer
waits out SO_SNDTIMEO, or, when the window opens first, sends its
record after the socket's SHT and the peer reads data after EOF. With
the peer's FIN in as well it returns -ECONNRESET for a stream its own
socket shut down.
End the wait when sending is shut down and test SEND_SHUTDOWN again
after it, ahead of the sk_state test, so the call fails with -EPIPE as
it does on entry.
Fixes: 0ea920d211e0 ("af_iucv: Return -EAGAIN if iucv msg limit is exceeded")
Cc: stable@vger.kernel.org # 6.18.x
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
---
v5: unchanged.
v4: unchanged, was 2/7. 2/10 closes what v3's note left open here: a
caller of iucv_send_ctrl() without the socket lock hiding
SEND_SHUTDOWN from the new check.
v4: https://lore.kernel.org/netdev/20261114-b4-disp-fc0634a3-v4-3-f96c506447ce@proton.me/
v3: https://lore.kernel.org/netdev/20261110-b4-disp-2a6b4364-v3-2-35677b68e697@proton.me/
It goes before 4/10, which lets sendmsg() wait for send memory without
the socket lock and would otherwise open the same gap a second time.
Three of the 53 default tests are about this, and net fails all three.
A writer parked on a full window sends its record after the socket's
own SHT when the window opens, so the peer reads data after EOF; it
waits out SO_SNDTIMEO when the window stays shut; and with the peer's
FIN in as well it gets -ECONNRESET. With this patch the first and the
third pass, and the second returns -EPIPE; that test still fails, as
its SHT finds no room in sk_sndbuf (one of the five in the cover
letter). With only the wait changed, the writer sends after the
shutdown in the first two and gets -ECONNRESET in the third. With only
the new SEND_SHUTDOWN check after the wait, it waits out SO_SNDTIMEO
again. With that check placed after the sk_state check, it gets
-ECONNRESET again.
---
net/iucv/af_iucv.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 4e69c7d6e3fb..c955ecd0c522 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -1053,10 +1053,16 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,
/* wait if outstanding messages for iucv path has reached */
timeo = sock_sndtimeo(sk, noblock);
- err = iucv_sock_wait(sk, iucv_below_msglim(sk), timeo);
+ err = iucv_sock_wait(sk, iucv_below_msglim(sk) ||
+ (sk->sk_shutdown & SEND_SHUTDOWN), timeo);
if (err)
goto fail;
+ /* return -EPIPE if sending has been shut down meanwhile */
+ if (sk->sk_shutdown & SEND_SHUTDOWN) {
+ err = -EPIPE;
+ goto fail;
+ }
/* return -ECONNRESET if the socket is no longer connected */
if (sk->sk_state != IUCV_CONNECTED) {
err = -ECONNRESET;
--
2.56.1
Technical Details
Message-ID:
<20261203-b4-disp-8029c32d-v5-3-0bce531e20d0@proton.me>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377007-linux-kernel-netdev=dewy.ruReferences:
<20261203-b4-disp-8029c32d-v5-0-0bce531e20d0@proton.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377007-linux-kernel-netdev=dewy.ru From: devnull+hexlabsecurity.proton.me@kernel.org (Bryam Vargas via B4 Relay) Newsgroups: linux.kernel.netdev Subject: [PATCH RFC net v5 03/10] net/iucv: fail sendmsg() with EPIPE once sending is shut down Date: Thu, 03 Dec 2026 22:02:15 -0500 Organization: Usenet Network Message-ID: <20261203-b4-disp-8029c32d-v5-3-0bce531e20d0@proton.me> References: <20261203-b4-disp-8029c32d-v5-0-0bce531e20d0@proton.me> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2661085"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Ps01IlUIbeUBk+N9rsT3R21Hlmw= sha256:zLsZ6cfWxiSLY+7g5kbVUcp9HV4GV0kUEWNb+yTLg3U= sha1:2rStTZZTZdmmJOU72wuYfT/2Z3g= sha256:QkQfid9PR1nLwIOQsXDzJVmYoRwnJiSKhaLOvg4Ceeo= 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 19AE7117ACF; Fri, 4 Dec 2026 06:02:43 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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 Sum48_TZxjSV; Fri, 4 Dec 2026 06:02:40 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-377007-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id A9A5A117ACC; Fri, 4 Dec 2026 06:02:30 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id F1ACE2232C; Fri, 4 Dec 2026 03:02:27 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796353338; b=4v8c5ZqPQKjE/dTJl2j0QsVWC8ACTT73DKwrksEZph8jctm+5zt5xluDjJPA8pI3VujB NPYRHeOm0f8/Vb7fe62sGQpt26KtiORz9xD/76EFhfARdZZZ//LQvSzERUzEoNP6rq90y BffKf907PSP1usNDdvAplLKC5btVZEEKBdN8853AXQWVNknfJ1UR8mxE5PcQTacN2wTfW xhWTi+o8Zn3wjoLvbqEAzrBOqp6Xe2jnISav5mBay2idsIKK8ijRfDPBagwiBL5bGKVEp zgr6Sxg6dDHm9KnQaKnUGWbSqYsI2vsvoD+uOslgp4DLXYWGduT8ZHS5cVjp9cuzjLQ== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796353338; h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=bsAtFOYr3L1ece6lJ+cPX2kzzYYDDhRVybERxdnkrFk=; b=Kl6Qx35pWkQXV6wdM5srFkf7tPA6tvKAT6uzK+D95PcuM9h91/I1f6D3dsuDC4LX60EV fLFkjIojwjbA1zBvnWiFi21McO9PJoIyNiY2b3izU83hrPfpc4tV+CiXx3Av/wBvoJBsk M6miS1vLCXnHq5iChzZqA4NOwOcJc2I9RFrYMaxY1KV7Z9YEitVvX6Z/0q1k/6aBGV+8i 3bwjZjh0Gw9pK7DmVxZci1BHZN4cbws0zuqvn/KbQ0yKYrN9UdBQC71HUdePnUG51tZdY QP6rRUgg//Y8NM0rjyxn4sCUOyzA8/My4riclm0ieiacffP9p/MWk5lnF04kqr2rM9g== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=a8YnKZOL; 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 63AA2606A6B4; Fri, 4 Dec 2026 03:02:18 +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=a8YnKZOL X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796353337; b=J6Pdf4RjGoxMqEKrJjVC2t1aSNlLrGq8KLNpMtHs4juEYs4PKCs/UiVNJ0RZR8/e7ToW 0XCLpRHsbDgSC85GB5pxizdgH7k5AJ6+oCSXcDwVs+fqAVusn8OM6Ao8hI/1xi5bHZiUS x9hSZ1grD8BuQ0ucnkwpK6OJq3gG9y+U15ofM0TqdLpQXCJO8kUilvUDyjHjAhLPJWxkw UZ9wkXD4r0309h/e4hMi9csHby9jeEtwPPVp2nxpT0u11GnB6YYdmiHm2zSuAIefz0dSQ 2Lae9aH1mSs+E4N7B9TvlMH4eG0kMuKGFW6EYP9+fHlpjaK7YMAT3AQOjrQKbYw3hmQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796353337; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=bsAtFOYr3L1ece6lJ+cPX2kzzYYDDhRVybERxdnkrFk=; b=lxMmzNBSdpnaO3jgYse7hcUKr2V+tovYGOn1MVyU9sSVaiRJ73Qqht5j/Gof1vI0Om9P 8NMcGIPiH0z5GUR0I1MZ2rXLpVUbcr6FSRYofPvlWPoKuej91jf+MOnV1swHlB33MQQD3 PcDj21U9eZ0EtiCFAgH/qYtKoDlzVYDylSY4HwQZVTWFsZFXhjZX9OL0FIK5vwtRT0Q6q SVb3aBqAaNUXo5CdBGn9BBgBLzYh0OqMvAxdVlz3t2L1ZwN6PEencK1Ovut7Dy8ldwlS1 G/KCaqm6Bzt/ZIu5LjJ1YEPU43OgOKIOgj7XR4nQtJ31E0hdJv2XEjjrHazaYICqUkg== 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=a8YnKZOL; arc=pass header.oldest-pass=0 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 8229D606A693; Fri, 4 Dec 2026 03:02:17 +0000 (UTC) X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796353337; b=BmT0NmQXHuTHQOvDTGEaHv3EsFbwFxLRrd0/rKMP9IevBO5vC+H/o5J6fJCZwcTVJqKS J0nUYHXg7WhdmD2lBRS78JVIE9CPTl9TLYKraZC8EYx0DYLw+rCsDPjZJMsRnUUIhVLf0 dP+Xr/vGCua+tL8CxJ4ry//xme7tnciWutKcs6pYPTKXKLWXG9huh/WaivwuZeo71Cmnd Br8Gs+h9wRHVVpX6XBlG+Jv4iJOcXyWkS+PqySuq6gv4vY6ysnLhyVX3WuXlgKtC3IIex rZWvwyG4ABYpy7AzavV+wDD4xWMomvs0PAw/4s260jLlMjS/gUZKwLycEFE/RggGd3Q== X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796353337; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=bsAtFOYr3L1ece6lJ+cPX2kzzYYDDhRVybERxdnkrFk=; b=DBZyhwqH0wU9yEgh+larLwRWnf0CnZXui9KCYBegbtLS2mg6LolobNGSzuk/2z1XIQyc +evhvM2k+tGsOah2CQNpm7aKKL9/a2SJfuNwkFFunafGSoE9Gm+MOdmHuUha5j/DPj2QX NYtY44H7ifNl4EpbtoyNMq5O6541xylikGZcO/rCMTidZWV2kagsGP5dOfrAFUVGGunON L/ZMdh2aV8pyYgJ7d73BUVvRJpAeQZkPnNnLXdZ29lcVp0PlvETvwthz2HnVya4i48iA5 DBASHr4hFICGh2sxuD9qBWQOceQQoftR2DkA6KkzG90TkcHOIwWy1Z/hHOkYvE/8CRg== X-ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 19C4F1F0092C; Fri, 4 Dec 2026 03:02:15 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796353337; bh=bsAtFOYr3L1ece6lJ+cPX2kzzYYDDhRVybERxdnkrFk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=a8YnKZOLBExuCoWmMwyiatkS1CUvmphSk7Tg8pieJW4R/EzF9L6vV/dREOrr566kG gtpd4gXoSNALybqWPdg1h3eEmu9/wFx0pi6LXcH3XKV5pTjOUC3DWgUmnoJwcqP9id yZu3Grl0QtDNd/VBAHGSDa4bkg4Gr1riKgWAvzQne+ceJptIHdcOsFyRotodgHjTAR G7h1AK+1jARAFfteBQhtXDgBp79gqOgpkVdl67XliYoXt9sGpY3K1A+sElAFd+lBJE TTfcDh6eVwUVfEb+HTta0JXJ6he10/qYsONJj2ENq759NsG8npiPSsGynr/qaWhe7q BLpL9y9I/8kMQ== X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 9D4304CC72; Fri, 4 Dec 2026 03:02:14 +0000 (UTC) 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: <20261203-b4-disp-8029c32d-v5-0-0bce531e20d0@proton.me> X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nagamani PV <nagamani@linux.ibm.com>, linux-s390@vger.kernel.org, Simon Horman <horms@kernel.org>, Thorsten Winkler <twinkler@linux.ibm.com> X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796353333; l=3065; i=hexlabsecurity@proton.me; s=default; h=from:subject:message-id; bh=oHjvGB0Izr3pY893uKFjNU6cnRzWWJNkJ/wtGKVUd9I=; b=Y91S++GHZ+iLtiNEBItxyWRQtae7gmOHzUP3ngg5rDL/7dSxHoWGB4kqPHa8Bl6bGmDhct13c gTEl9JH8ZBrAv1Sqx8vBn+gdRV8QeLH9YI/obcAentY9m7cFBwziJaQ X-Developer-Key: i=hexlabsecurity@proton.me; a=ed25519; pk=xw1AhCtQdvuoQc+bOQIYy9o8G++cp4/VniI2G/tc3G8= X-Endpoint-Received: by B4 Relay for hexlabsecurity@proton.me/default with auth_id=893 X-Original-From: Bryam Vargas <hexlabsecurity@proton.me> X-Reply-To: hexlabsecurity@proton.me