Re: [PATCH net v2] net/smc: don't spin in smc_rx_recvmsg() while a pipe holds spliced data

From: Dust Li

Date: Wed Nov 04 2026 - 12:32:10 EST


On 2026-10-29 03:03:33, Bryam Vargas via B4 Relay wrote:
>From: Bryam Vargas <hexlabsecurity@xxxxxxxxx>
>
>While bytes spliced off the RMB are still in a pipe, recvmsg() waits
>for the pipe to release them before it copies the data behind them.
>The path to that wait skips the timeout and signal checks, and
>smc_rx_wait() returns at once on RCV_SHUTDOWN. With a signal pending,
>after SHUT_RD, or once the peer closes or shuts down writing,
>recvmsg() spins on a CPU until the pipe is drained, and SIGKILL cannot
>stop it. MSG_DONTWAIT and an expired SO_RCVTIMEO wait there too
>instead of returning -EAGAIN.
>
>Check the timeout and signals before that wait, and end it when the
>pipe releases the data or the connection is killed, not on RCV_SHUTDOWN.
>A zero-length read returns 0 without waiting for the pipe; a
>non-blocking one returns -EAGAIN while poll() still reports the socket
>readable (splice() can still take those bytes). The wait sets
>SOCKWQ_ASYNC_WAITDATA like smc_rx_wait(), so a byte arriving behind
>the pipe raises no SIGIO on a reader already asleep for it, and a full
>barrier orders its wait queue entry before its read of splice_pending,
>so no wake is lost.
>
>Fixes: 9014db202cb7 ("smc: add support for splice()")
>Cc: stable@xxxxxxxxxxxxxxx
>Signed-off-by: Bryam Vargas <hexlabsecurity@xxxxxxxxx>

Reviewed-by: Dust Li <dust.li@xxxxxxxxxxxxxxxxx>

Best regards,
Dust