From: Alexandra Winter <wintera@linux.ibm.com>
To: hexlabsecurity@proton.me,
Thorsten Winkler <twinkler@linux.ibm.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: linux-s390@vger.kernel.org, Nagamani PV <nagamani@linux.ibm.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Hidayath Khan <hidayath@linux.ibm.com>,
Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net v2 1/2] net/iucv: clear hs_dev before dropping its reference
Date: Wed, 4 Nov 2026 17:14:40 +0100 [thread overview]
Message-ID: <307b169a-6ac8-4ae3-aded-b40a86608d01@linux.ibm.com> (raw)
In-Reply-To: <20261028-b4-disp-dd3e4ebb-v2-1-3747658d59bd@proton.me>
On 29.10.26 05:46, Bryam Vargas via B4 Relay wrote:
> iucv_sock_close() drops the socket's reference on its HiperSockets
> device and only then clears iucv->hs_dev,
I agree on the analysis that this order is wrong.
while afiucv_hs_rcv() compares
> that field against the ingress device for every socket in the list,
> under iucv_sk_list.lock and not the socket lock. Between the two it
> compares a pointer the socket no longer holds; KCSAN reports the plain
> read against the plain write.
Could you add an excerpt of the KCSAN report to the commit message?
The order dates from 800c5eb7b5eb, the
> compare from 80230a18c164. No user-visible effect is known: the receive
> path holds the ingress device, so the stale pointer is compared, never
> dereferenced.
>
I agree, I cannot see how reading a stale pointer can result in a real
problem. So this is not urgent to fix.
> Clear the pointer first, through a local, then drop the reference, and
> mark the lookup's read and the two stores that race with it: the clear
> in close() and the child's store in afiucv_hs_callback_syn() (the child
> is in iucv_sk_list from iucv_sock_alloc() on). The child now takes its
> device and sk_bound_dev_if from the frame the lookup matched, held
> before it is published, instead of reading the listener's fields:
> close() clears them under lock_sock(), which the bh_lock_sock() in
> afiucv_hs_callback_syn() does not exclude, so the callback can pass its
> IUCV_LISTEN check and then read a field close() has cleared. That a SYN
> can be accepted while the listener closes is left to the socket-locking
> rework; this is its KCSAN-visible part. bind()'s hs_dev store runs
> under the list's write lock and stays plain. sk_bound_dev_if, which
> getsockopt() reads without the lock, is marked where close(), bind()
> and the child store it; annotation only.
>
[...]
> ---
> Nagamani PV's "net/iucv: fix races in afiucv_netdev_event()" [1] marks
> the same store in close(); Alexandra Winter asked him to hold it for the
> locking series and he agreed [2]. This one goes out now, on a new and
> independent KCSAN report, and its close() hunk subsumes his, which marks
> the store but keeps dev_put() first; once this is applied, the
> afiucv_netdev_event() read is what remains for his patch.
Just thinking out loud:
Would it be a simpler alternative to clear iucv->hs_dev in
iucv_sock_kill after iucv_sock_unlink? then it also would help for the
afiucv_netdev_event() issue (read still needs to be put under lock).
It's hard to discuss this with an AI, while the locking series is still
missing. I would still prefer to fix that first.
next prev parent reply other threads:[~2026-11-04 16:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 4:46 [PATCH net v2 0/2] net/iucv: two fixes in the HiperSockets receive path Bryam Vargas via B4 Relay
2026-10-29 4:46 ` [PATCH net v2 1/2] net/iucv: clear hs_dev before dropping its reference Bryam Vargas via B4 Relay
2026-11-02 4:47 ` netdev-bot+sashiko
2026-11-04 16:14 ` Alexandra Winter [this message]
2026-10-29 4:46 ` [PATCH net v2 2/2] net/iucv: do not count the SHT frame against the receive window Bryam Vargas via B4 Relay
2026-11-02 4:47 ` netdev-bot+sashiko
2026-11-04 17:13 ` Alexandra Winter
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=307b169a-6ac8-4ae3-aded-b40a86608d01@linux.ibm.com \
--to=wintera@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hexlabsecurity@proton.me \
--cc=hidayath@linux.ibm.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nagamani@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=twinkler@linux.ibm.com \
/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
all inboxes | Powered by JetHome®