> From: Jerome Mohm <[email protected]>
> 
> vsock_bpf_recvmsg() sleeps in vsock_msg_wait_data() with the socket lock
> held, so the virtio delivery worker, which needs that lock, deadlocks
> with the reader and all vsock rx on that worker stops.
> 
> Release the lock around the wait. The reader can then wake without
> data, so the wait also has to loop; the fix needs both halves. The loop
> ends on data, the timeout, a signal (the sleep returns at once while
> one is pending), a lost transport after a failed connect(), or a state
> in which __vsock_recvmsg() would not wait. Those states go to
> __vsock_recvmsg(), so a non-blocking read now sees them before -EAGAIN.
> A blocking read interrupted by a signal now gets -EINTR, or restarts,
> instead of -EAGAIN. One tested difference remains: a reader asleep at a
> virtio transport reset gets -ENOTCONN, where a native socket gets
> [ ... ]
> 
> Fixes: 634f1a7110b4 ("vsock: support sockmap")
> Suggested-by: Alexei Starovoitov <[email protected]>
> Cc: [email protected]
> Signed-off-by: Jerome Mohm <[email protected]>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2


Reply via email to