Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Extract trait #1

Merged
merged 8 commits into from
Aug 14, 2021
Merged

Add Extract trait #1

merged 8 commits into from
Aug 14, 2021

Conversation

Thomasdezeeuw
Copy link
Owner

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 before
completion. However to give the Futures a nice API we don't return the
input arguments and try to match the API that don't take ownership of
argument, e.g fs::File::open just returns a File not the path
argument.

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 just
that: extract the input arguments from Future operations.

Allow for extraction of the input arguments.
Allow the path to be returned.
To match the write API we come to expect from io::Write.

At the same time implement Extract so that the buffer can still be
retrieved.
Removes Extractor from the root of the crate and only re-exporting the
Extract trait.
@Thomasdezeeuw Thomasdezeeuw merged commit 61d7a81 into main Aug 14, 2021
@Thomasdezeeuw Thomasdezeeuw deleted the extractor branch August 14, 2021 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant