Commit Graph

7 Commits

Author SHA1 Message Date
Jens Axboe
76b61ebf1b Add io_uring_cqe_seen()
There's a failure case where an application gets a cqe entry, but
the kernel can then overwrite it before the application is done
reading it. This can happen since the io_uring_{get,wait}_completion()
interface both returns a CQE pointer AND increments the ring index.
If the kernel reuses this entry before the applications is done reading
it, the contents may be corrupted.

Remove the CQ head increment from the CQE retrieval, and put it into
a separate helper, io_uring_cqe_seen(). The application must call this
helper when it got a new CQE entry through one of the above calls, and
it's now done reading it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-17 09:42:23 -06:00
Jens Axboe
bc4e4a7427 test/poll: ignore parent dying
The parent may well die before the child is done, as long as it wrote to
the pipe, we're fine.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18 18:48:40 -07:00
Jens Axboe
a2fc9f13b5 test/poll: simply test case
Just setup one ring in the child process, and poll for when the
read side of the pipe is readable. From the parent, write something
to the pipe.

If nothing happens within 1 second, fail the test.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18 15:14:43 -07:00
Jens Axboe
3640699bea Switch to IORING_OP_POLL_ADD/REMOVE
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18 07:00:14 -07:00
Jens Axboe
5789a6351a Add sqe prep helpers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17 18:12:22 -07:00
Jens Axboe
768d4559d0 Update POLL API
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17 14:24:28 -07:00
Jens Axboe
ce899b79f9 Add test case for IORING_OP_POLL
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17 11:40:24 -07:00