-
Notifications
You must be signed in to change notification settings - Fork 654
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
lio_listio needs to use unique storage locations for the list argument #870
Comments
asomers
added a commit
to asomers/nix
that referenced
this issue
Mar 5, 2018
The new LioCb structure allows us to control the exact arguments passed to lio_listio, guaranteeing that each call gets a unique storage location for the list argument. This prevents clients from misusing lio_listio in a way that causes events to get dropped from a kqueue Fixes nix-rust#870
asomers
added a commit
to asomers/nix
that referenced
this issue
Mar 5, 2018
The new LioCb structure allows us to control the exact arguments passed to lio_listio, guaranteeing that each call gets a unique storage location for the list argument. This prevents clients from misusing lio_listio in a way that causes events to get dropped from a kqueue Fixes nix-rust#870
asomers
added a commit
to asomers/nix
that referenced
this issue
Mar 22, 2018
The new LioCb structure allows us to control the exact arguments passed to lio_listio, guaranteeing that each call gets a unique storage location for the list argument. This prevents clients from misusing lio_listio in a way that causes events to get dropped from a kqueue Fixes nix-rust#870
bors bot
added a commit
that referenced
this issue
Apr 7, 2018
872: Change sys::aio::lio_listio to sys::aio::LioCb::listio r=asomers a=asomers The new LioCb structure allows us to control the exact arguments passed to lio_listio, guaranteeing that each call gets a unique storage location for the list argument. This prevents clients from misusing lio_listio in a way that causes events to get dropped from a kqueue Fixes #870
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When delivering notifications via
kevent
, the kernel treats the address of thelist
argument as a theident
of the event. Within the kernel,ident
is treated as a unique identifier. So there can only be one event with a givenident
value in the kernel at any one time. However, Nix'ssys::aio::lio_listio
allows the user to supply a temporaryVec
as thelist
argument. If the user callslio_listio
several times in a row, each with the same value oflist
(but different contents),kevent
may deliver too few notifications.The most fool-proof solution will probably be to create a
struct LioCb
object that owns all of theAioCb
objects, and also owns thelist
variable as aVec
. That will achieve two things:LioCb
object will be forced to outlive the kernel's knowledge of it, since it owns the individualAioCb
slist
argument is guaranteed to be unique for all concurrentlio_listio
calls, becauseVec
is stack-allocated and theLioCb
object must outlive the kernel's knowledge of the event.https://www.freebsd.org/cgi/man.cgi?lio_listio
The text was updated successfully, but these errors were encountered: