You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the destructor ~ZeroCopyRxBufferPool(), the munmap of rq_ring_.ring_ptr is performed unconditionally, but the mmap that sets rq_ring_.ring_ptr is only called inside register_ifq_(). If the constructor throws an exception after register_ifq_() succeeds but before rq_ring_.ring_ptr is assigned (e.g., after the mmap call but before the assignment completes), the destructor will still run and attempt to munmap an uninitialized or partially initialized pointer. However, the more realistic scenario is that if register_ifq_() throws, the destructor runs and rq_ring_.ring_ptr is zero-initialized, leading to munmap of a null pointer, which is undefined behavior.
In register_ifq_(), if the mmap call for the refill ring fails (line 226-231), the function throws an exception. However, the io_uring_register_ifq call on line 220 has already succeeded, registering the interface queue with the kernel. There is no mechanism to unregister the ifq on this error path, leaving the kernel with a dangling registration. The TODO comment on line 224 acknowledges this but does not implement the cleanup.
In the handle_finish method (line 185-195), the code accesses cqe + 1 to get the io_uring_zcrx_cqe. This assumes that the CQE is followed by an extended CQE structure. This is only valid if the ring was set up with CQE32 enabled (i.e., IORING_SETUP_CQE32). If the user creates a ZeroCopyRxBufferPool without enabling CQE32 on the runtime, this access will read out-of-bounds memory, leading to undefined behavior. The documentation and test do enable CQE32, but the pool constructor does not enforce or check this requirement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We will soon have device-less mode for zcrx.
for linux 7.1
axboe/liburing#1527