On 04.12.26 04:02, Bryam Vargas via B4 Relay wrote:
> From: Bryam Vargas <hexl…@proton.me>
>
> A HiperSockets socket is IUCV_BOUND from bind() until the SYN|ACK
> arrives, with or without a SYN on its way, and nothing tells the two
> apart:
Maybe sth like this is even clearer?:
..until the SYN|ACK arrives. The sk_state is the same whether or not a
SYN has already been sent. This leads to the following problems:
No strong feeling, but as this is still an RFC...
>
> - SO_MSGLIMIT is accepted after the SYN carried msglimit to the peer as
> the receive window, while recvmsg() counts the frames it reads against
> the new value. When the limit is lowered, a peer that keeps to its
> window has the socket closed on it once the receive buffer is full and
> frames wait in backlog_skb_q: WARN_ON(), -EFAULT, the rest of the
> stream lost. When it is raised far enough, no window update is sent
> and the peer's writer waits for one that only a data frame from us
> would carry.
> - A later connect() sends another SYN: one restarted after a signal, or
> one that follows a non-blocking or timed-out connect(). The listener
> makes a second child with the same names.
> - A SYN|ACK or SYN|FIN is accepted by a socket that sent no SYN.
>
> Record that the SYN was handed to the device. From then on SO_MSGLIMIT
> fails with -EINVAL, as on a connected socket, and connect() sends no
> other SYN: it waits for the reply to the first, or fails with -EALREADY
> if it names another peer. A SYN|ACK or SYN|FIN for a socket that sent no
> SYN is dropped. A SYN that was not sent records nothing.
>
> Fixes: 3881ac441f64 ("af_iucv: add HiperSockets transport")
> Fixes: 800c5eb7b5eb ("af_iucv: change net_device handling for HS transport")
> Suggested-by: Alexandra Winter <wint…@linux.ibm.com>
> Cc: stab…@vger.kernel.org # 6.18.x
> Signed-off-by: Bryam Vargas <hexl…@proton.me>
> ---
I tested the "SO_MSGLIMIT after connect()" issues and the both went away
with this fix.
I also reproduced the "Second SYN after non-blocking connect()", and it
also went away with this fix.
Tested-by: Alexandra Winter <wint…@linux.ibm.com>
Reviewed-by: Alexandra Winter <wint…@linux.ibm.com>