Repository navigation
Conversation
Berrysoft
requested changes
Nov 11, 2026
| // The result of a zerocopy notification is a set of flags, not an | ||
| // errno: with `IORING_SEND_ZC_REPORT_USAGE` the kernel sets | ||
| // `IORING_NOTIF_USAGE_ZC_COPIED` (`1 << 31`) when the data was copied. | ||
| Ok(result as u32 as usize) |
Member
There was a problem hiding this comment.
Should clear the flag instead of a conversion.
| //! A zerocopy notification reports its usage in the sign bit of `res`, which | ||
| //! must not be read as an errno. | ||
|
|
||
| #![cfg(all(io_uring, not(fusion)))] |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The
resof a zerocopy notification isn't an errno. When the send setsIORING_SEND_ZC_REPORT_USAGE, the kernel putsIORING_NOTIF_USAGE_ZC_COPIED(1 << 31) there if it copied the data (uapi, v6.2, notif.c).create_resultreads it as a negative errno and negates it (iour/mod.rs).-i32::MINoverflows, so a debug build panics and a release build returns anio::Errorwith a garbage code.compio's own
SendZcops don't set the flag, but anyOpCodethat setszc_flagsto get the usage report runs into this.create_resultnow checksIORING_CQE_F_NOTIFfirst and returns the notification'sresasu32.Extra::is_notificationdocuments what that value holds.The new test sends over loopback with
REPORT_USAGE, where the kernel always copies, and checks that the notification reports the copy. On master it panics with "attempt to negate with overflow"; with this change it passes on Linux 6.18. It skips on kernels that reject the flag.