From: sashiko-bot@kernel.org
To: "Bryam Vargas" <hexlabsecurity@proton.me>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH RFC net v5 03/10] net/iucv: fail sendmsg() with EPIPE once sending is shut down
Date: Sat, 05 Dec 2026 03:02:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-250964@kernel.org> (raw)
In-Reply-To: <20261203-b4-disp-8029c32d-v5-3-0bce531e20d0@proton.me>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net/iucv: plain sk_shutdown reads in iucv_sock_sendmsg() race
with writers
--
commit 5b5347f236dbd775bba8a7293c92304aec4a4bad
Author: Bryam Vargas <hexlabsecurity@proton.me>
net/iucv: fail sendmsg() with EPIPE once sending is shut down
This commit updates iucv_sock_sendmsg() to end the message-limit wait when
SEND_SHUTDOWN is set and re-check SEND_SHUTDOWN after the wait so it returns
-EPIPE instead of sending data or returning -ECONNRESET.
> diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
> index 4e69c7d6e3fb2..c955ecd0c5228 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;
> + }
[Severity: Low]
Can these plain reads of sk->sk_shutdown race with iucv_callback_shutdown()?
iucv_sock_sendmsg() holds lock_sock(sk), which does not exclude tasklet
context acquiring only bh_lock_sock(sk) without checking
sock_owned_by_user(sk):
CPU0 CPU1
iucv_sock_sendmsg() iucv_callback_shutdown()
lock_sock(sk) bh_lock_sock(sk)
sk->sk_shutdown & SEND_SHUTDOWN sk->sk_shutdown |= SEND_SHUTDOWN
<-- data race
This creates an unmarked data race on sk->sk_shutdown that can trigger
KCSAN warnings. Using READ_ONCE(sk->sk_shutdown), as sock_wait_for_wmem()
and sock_alloc_send_pskb() do, avoids the unmarked read race.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-b4-disp-8029c32d-v5-0-0bce531e20d0@proton.me?part=3
next prev parent reply other threads:[~2026-12-05 3:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 3:02 [PATCH RFC net v5 00/10] net/iucv: serialize the HiperSockets receive path with the socket lock Bryam Vargas via B4 Relay
2026-12-04 3:02 ` [PATCH RFC net v5 01/10] net/iucv: record that a HiperSockets socket sent its SYN Bryam Vargas via B4 Relay
2026-12-04 18:58 ` Alexandra Winter
2026-12-04 3:02 ` [PATCH RFC net v5 02/10] net/iucv: do not clear SEND_SHUTDOWN to send a control frame Bryam Vargas via B4 Relay
2026-12-04 3:02 ` [PATCH RFC net v5 03/10] net/iucv: fail sendmsg() with EPIPE once sending is shut down Bryam Vargas via B4 Relay
2026-12-05 3:02 ` sashiko-bot [this message]
2026-12-04 3:02 ` [PATCH RFC net v5 04/10] net/iucv: run recvmsg() under the socket lock Bryam Vargas via B4 Relay
2026-12-05 3:02 ` sashiko-bot
2026-12-04 3:02 ` [PATCH RFC net v5 05/10] net/iucv: factor out the HiperSockets frame dispatch and state changes Bryam Vargas via B4 Relay
2026-12-04 3:02 ` [PATCH RFC net v5 06/10] net/iucv: serialize HiperSockets receive with the socket lock Bryam Vargas via B4 Relay
2026-12-05 3:02 ` sashiko-bot
2026-12-04 3:02 ` [PATCH RFC net v5 07/10] net/iucv: set RCV_SHUTDOWN under the socket spinlock Bryam Vargas via B4 Relay
2026-12-05 3:02 ` sashiko-bot
2026-12-04 3:02 ` [PATCH RFC net v5 08/10] net/iucv: return EOF to a reader parked when the peer closes Bryam Vargas via B4 Relay
2026-12-05 3:02 ` sashiko-bot
2026-12-04 3:02 ` [PATCH RFC net v5 09/10] net/iucv: decrement pendings when a pending frame's transmit fails Bryam Vargas via B4 Relay
2026-12-05 3:02 ` sashiko-bot
2026-12-04 3:02 ` [PATCH RFC net v5 10/10] net/iucv: forget a SYN that the device reports unreachable Bryam Vargas via B4 Relay
2026-12-05 3:02 ` sashiko-bot
2026-12-04 11:05 ` [PATCH RFC net v5 00/10] net/iucv: serialize the HiperSockets receive path with the socket lock Hidayath Khan
2026-12-05 3:02 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-250964@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hexlabsecurity@proton.me \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox