tests/recv-bundle-inc-buf-more: test missing F_BUF_MORE flag with bundle + incremental
PATCH 1/1 tests/recv-bundle-inc-buf-more: test missing F_BUF_MORE flag with bundle + incremental
Add a regression test for a kernel bug where IORING_CQE_F_BUF_MORE was silently dropped during bundle recv retries with provided buffer rings
+ incremental recv + bundle recv.
The kernel's io_recv_finish() merges CQE flags across retry iterations using:
cflags = req->cqe.flags | (cflags & CQE_F_MASK);
CQE_F_MASK did not include IORING_CQE_F_BUF_MORE, so the flag was lost on the final retry iteration when a buffer entry was partially consumed. This caused userspace to incorrectly advance its buffer ring head past an entry the kernel still considers in use.
The test uses non-aligned send chunks (3000 bytes vs 4096-byte buffer entries) and sqe->len = 0 to avoid MSHOT_CAP blocking the retry path, then verifies that BUF_MORE is set on every CQE where the cumulative consumption is not a multiple of the entry size. The retry path triggering isn't 100% deterministic so we tried forcing that by prefilling the socket with data at start so that when we read, we are more likely to receive data and thus trigger a retry.
--- test/Makefile | 1 + test/recv-bundle-inc-buf-more.c | 395 ++++++++++++++++++++++++++++++++ 2 files changed, 396 insertions(+) create mode 100644 test/recv-bundle-inc-buf-more.c
test/Makefile +1 -0
@@ -216,6 +216,7 @@ test_srcs := \ read-mshot-empty.c \ read-mshot-stdin.c \ read-write.c \ + recv-bundle-inc-buf-more.c \ recv-bundle-short-ooo.c \ recv-inc-ooo.c \ recv-msgall.c \
test/recv-bundle-inc-buf-more.c new file +395 -0
395 lines not on this page · raw message
--
2.53.0-Meta