diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-11-14 02:39:48 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-11-14 02:39:48 +0000 |
| commit | 69f61cee2efb1eec0640ca7de9b2d51599569a5d (patch) | |
| tree | 4c4868aa1e6ea588493ac385eaed91349a4a6739 /include/os/freebsd/spl/sys/simd_aarch64.h | |
| parent | 00b4d712e2be54b8c87a7fd7f215ad5ef7845d5b (diff) | |
The pr_soreceive method first scans the buffer holding the both I/O sx(9)
and socket buffer mutex(9) and after figuring out how much needs to be
copied out drops the mutex. Since the other side may only append to the
buffer, it is safe to continue the operation holding the sx(9) only.
However, the code had a bug that it used pointer in the very last mbuf as
marker of the place where to stop. This worked both in a case when we
drain a buffer completely (marker points at NULL) and in a case when we
wanted to stop at MSG_EOR (marker points at next mbuf after MSG_EOR).
However, this pointer is not consistent after we dropped the socket buffer
mutex.
Rewrite the logic to use the data length as bounds for the copyout cycle.
Provide a test case that reproduces the race. Note that the race is very
hard to hit, thus test will pass on unmodified kernel as well. In a
virtual machine I needed to add tsleep(9) for 10 nanoseconds into the
middle of function to be able to reproduce.
PR: 290658
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D53632
Fixes: d15792780760ef94647af9b377b5f0a80e1826bc
Diffstat (limited to 'include/os/freebsd/spl/sys/simd_aarch64.h')
0 files changed, 0 insertions, 0 deletions
