Article View: linux.kernel.netdev
Article #16496[PATCH RFC net v4 3/8] net/iucv: fail sendmsg() with EPIPE once sending is shut down
From: Bryam Vargas via B4 Relay
Date: Sun, 15 Nov 2026 01:29
Date: Sun, 15 Nov 2026 01:29
68 lines
13311 bytes
13311 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>
---
v4: unchanged, was 2/7. What v3's note left open here, a caller of
iucv_send_ctrl() without the socket lock hiding SEND_SHUTDOWN from the
new test, is closed by 2/8.
v3: https://lore.kernel.org/netdev/20261110-b4-disp-2a6b4364-v3-2-35677b68e697@proton.me/
It goes before 4/8, 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 test after
it, it waits out SO_SNDTIMEO again; with the test placed after the
state test 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 92468293f7c1..d2d47f33d08b 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -1064,10 +1064,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.0
Technical Details
Message-ID:
<20261114-b4-disp-fc0634a3-v4-3-f96c506447ce@proton.me>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363519-linux-kernel-netdev=dewy.ruReferences:
<20261114-b4-disp-fc0634a3-v4-0-f96c506447ce@proton.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363519-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 v4 3/8] net/iucv: fail sendmsg() with EPIPE once sending is shut down Date: Sat, 14 Nov 2026 20:29:21 -0500 Organization: Usenet Network Message-ID: <20261114-b4-disp-fc0634a3-v4-3-f96c506447ce@proton.me> References: <20261114-b4-disp-fc0634a3-v4-0-f96c506447ce@proton.me> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1703296"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Z0HWKl6apvLP8s05Y5131UA8QGs= sha256:aGBkbD51YroOszzxTDAJjUehrYhtDR8A9e55KMvggAs= sha1:nYZeaW6yDEDXz3/j03oNgVoksAA= sha256:IoZb/G+9dHzdLQc+gxgh/qZgkwnNIeAfweP4Kgq8zC8= 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 9D196114917; Sun, 15 Nov 2026 04:29:49 +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 koeWkLnrB5VZ; Sun, 15 Nov 2026 04:29:45 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363519-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 77780114908; Sun, 15 Nov 2026 04:29:37 +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 BDC8C3CF52; Sun, 15 Nov 2026 01:29:33 +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=1794706162; b=AJBcRhU+rzbdeJ36uaZ0liRJ7JegCSaZ5+7p5j3+yD0BMxAh/csajwTNVlbtEjAFFqOJ DW13m5kjYu7Fq8Tc93oDqB/WcjPH+g1jWRMyXb2gmZ+/qBRhSC+qdy4d5gMMAPYvd3LWQ tiLAzzWL6mfc9vCdH3m3l7qfffuidW/dXOBRRZL14jZ4Yvj0kjc2ASv91Edolq3zkLqCH qdovQyjAykqg7L6AB72yoL2ub19srLp7gvbeGfXhlYKyfB0SqT9+OulNSCVIUkpfeJImS YzCnUwYruTnuB9QwH64+Dy7aWFyrTHL5eh7PFk06Ne6Xu6cO3iAViv7Sp0pehgU4RvA== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794706162; 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=GXiewsrwXHEqHKssXIWsZxjImmzf+wuY5sA2h0Y2vrg=; b=M056JfWXJ8MTGAX4rMZIu1iDKvufRmL2I7ZKfCI34r7dqKMh/z6Q05KMQcgngtf8LcP5 1WjRjhysagrSIQilMe7y4sekozkhgVw9TyOdBt2xQgz8fqRHc3DZnZPj9EYpP2BaHBuj9 d4c5dG9uEHIGtzvaVg0JEcU71ComDdSDnqfWGoSipQ670V6V4o58A2tKzkQwuLxmceGWl uc9xRuXpcsmLsb9lsK+yp89/fiLnnefK8LcdgmlQfkHa1Eus/W3wU+DpDL8QZKkdvXFXf MBDnWrqk1BEvTtl4ggaHZIaqD+DvAegYyT2Seiv/v0K8S5edjzvNgSDnqyZfcwPQ5YA== 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=DS9xspk2; 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 71355606A89B; Sun, 15 Nov 2026 01:29:22 +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=DS9xspk2 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=1794706161; b=Dh63Mrh9DV7SQRBKPUEiUAw9/LZYjBJzmxkepoPS4ketm5BG3p0xSwj6Rh57V1//VI5X a6aqlWUcZiyHjpTGA4BCWncr//+s4MycQh01g7DNpRH33SjUXA+vPZku2JwbdcGqGxJbD 0gAWN1ygPRvoJkaC/52KiqLsov8+p9di2xrOQEUnJ1E3A1dAudiMinVQeaUImSCDYoMio ok/B1Ly/dDbvOfl2MJy5VMGyHAhgkuJvfd/Gz7oAquCQOn7p5twjU8HUtxmF4NhZ8tAYs IkyGX+Fh/Fa/NqARNFWN6y9NmzyD0pBn9bzesKr/BK4F2K0K/UxWCf6qs4ezgzaGgtw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794706161; 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=GXiewsrwXHEqHKssXIWsZxjImmzf+wuY5sA2h0Y2vrg=; b=xE7Q3dSh5gf9+2tPCbVBlTWdFYIo4GUIUjNBsoiNZXi+ORGFHmDcgGKKIGvsEBYsZ2wu ypO5z3TrTf6i7BqwnVDG7rVObBv6NipviS0fVuDJ+DOTPogxUTYle4VkToQPJXslq8Rwn Whctp+ILuuhF/tLxR0wN+yjTxBYv+oFjzzRMa2g9dCfq6mKWGg38Wg6XvHNW1GuQ73wfm QMKtydYWoiFAs9iiG7zEVrUtSYkgZ0gtYp42EhJIJ+ONikV4mmaUKvIhGiEdqLpRG7ijd iz5tBI6LAParWIXNJOngimP2aoA96eeADQ0szjgh8B++Bf/LVcLIsLSI/RAYYoWFgcQ== 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=DS9xspk2; 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 83D9E606A331; Sun, 15 Nov 2026 01:29:21 +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=1794706161; b=bv5BGXzZwAC/z7eYvGsvmxjxTf+lljcmWYRL5lIeXEpZpj8KjEPaIFZEEpipfjUt/Y/C ImNMmoI6b+XPehj19BOY31TnpBuc0DCCEimIPhCxiHE8UWJqiGewAs+EMH7E5Zogwzio4 SiAWWgqPhClaOVzupgQNHhRsySNwtklARNfU8m6lg1CgFMe2CfPwXUOt/T67VnqNvdgXB v33PpBLHtniJXsVqVwHAl2CKBf8NQpTGBXys0+MiycDehIi9M4XYBXVXAiI/3DsYN2ipo 469tN7T+BX6+m2FW8kvgUCoaEouLAFX7kkHKf+6lVfXo7yFyVAwOCNbTwAdySfoN0lA== X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1794706161; 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=GXiewsrwXHEqHKssXIWsZxjImmzf+wuY5sA2h0Y2vrg=; b=3gvkYnvGC30a0YsCxGp4myUkNU8yITd2ZtvQNjCrGjtihnlX34uzKSq/bKcp5//nl1Px RoNyhi/XIyNIyqjcmzHtOcQ1IyDvT70ngjLGLVuQ2fKbKp9vrlHg9KgcbY8n49vCOkQ1N 420gg390dxMWV9t6oHapuNjonJqZ0RyShDsQINQFaguhJvSQGBRCCWCmJSO8ErVDfKRPX 9lpg4WdapjtG8uBrfJuPSPD/MPIrnrIu+Nzgaq5iJqPYRZOWzmDM7dEnFsKFUg8rvYocs i+tjGSyhipRNFYS2gBWgOxCHSh7iYfZPUmtVbCC1PbIQr44HvgEvjpEjdB8SZ1cqFbw== 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 2323B1F000C7; Sun, 15 Nov 2026 01:29:20 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794706161; bh=GXiewsrwXHEqHKssXIWsZxjImmzf+wuY5sA2h0Y2vrg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=DS9xspk2dOVPAhF4Jd3p2Ehb92d50liU8RGXYIej1fOtA8fprUhqXhoVna9lwGXeQ 3cc8eGGjQOUrzDm4WCn9ZjLddJbRdsBdB+hNikTl2+iRWsE63A1i4S0RKhXsOZrh5o k6pn43UTVXGIvyLXt/KBLXmHFNzV5XLOV799fgS00Tpmul5R56cwwy36yAyio8pF57 LIypbM5/ojB9pkQoOlu3C74Vm1/te/2dh0ccWfr8jpIZ5lF1/6dDD6LOVoZxfGpdFH dBHluxj34i3iC7DmxuGr0Ipxi0kz6CGHhPw2aKbIu5uoBzcrFLtn5piYWvOXH1Kpb6 Zoe9EGabJiv4Q== X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id A09D549F14; Sun, 15 Nov 2026 01:29:19 +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: <20261114-b4-disp-fc0634a3-v4-0-f96c506447ce@proton.me> X-Cc: Thorsten Winkler <twinkler@linux.ibm.com>, Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nagamani PV <nagamani@linux.ibm.com>, linux-s390@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1794706158; l=2927; i=hexlabsecurity@proton.me; s=default; h=from:subject:message-id; bh=eFvlFTHXbJiOGhWbQc9xS9npNxJ3DnULBhzpHra8NGk=; b=v5RrJ95tu0iMgAiQdDzS8ILt9W4ALLhsEUMf6zgJtzfucF5BK117j9CqQYKSZnAUbCiipzlc2 kgE6rQbjSjsBeLuax13T0PzR6XkMtIf4YuXhw6+ySSmldN8aXMmP0nt 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 X-Received-Bytes: 13114