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.
Because of the way that iouring works the kernel needs mutable access to the
input to a systemcall for entire duration the operation is in progress. For
example when reading into a buffer the buffer needs to stay alive until the
kernel has written into it, or until the kernel knows the operation is
canceled and won't write into the buffer anymore. If we can't ensure this
the kernel might write into memory we don't own causing write-after-free
bugs.
To ensure the input stays alive A10 needs ownership of the input arguments
and leaks the inputs when a
Future
operation is dropped beforecompletion. However to give the
Future
s a nice API we don't return theinput arguments and try to match the API that don't take ownership of
argument, e.g
fs::File::open
just returns aFile
not the pathargument.
In some cases though we would like to get back the input arguments from the
operation, e.g. for performance reasons. The
Extract
trait allow you to do justthat: extract the input arguments from
Future
operations.