linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* io_uring: REQ_F_PREPPED race condition with punting to workers
@ 2019-05-03 10:22 Stefan Bühler
  2019-05-03 14:48 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Bühler @ 2019-05-03 10:22 UTC (permalink / raw)
  To: Jens Axboe, linux-block, linux-fsdevel

Hi,

if the initial operation returns EAGAIN (and REQ_F_NOWAIT) is not set,
io_submit_sqe copies the SQE for processing in a worker.

The worker will then read from the SQE copy to determine (some)
parameters for operations, but not all of those parameters will be
validated again, as the initial operation sets REQ_F_PREPPED.

So between the initial operation and the memcpy is a race in which the
application could change the SQE: for example it could change from
IORING_OP_FSYNC to IORING_OP_READV, which would result in broken kiocb
data afaict.

The only way around that I can see right now is copying the SQE in
io_submit_sqe (moving the call to io_cqring_add_event to io_submit_sqe
should simplify this afaict): does that sound acceptable?

cheers,
Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-13 15:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 10:22 io_uring: REQ_F_PREPPED race condition with punting to workers Stefan Bühler
2019-05-03 14:48 ` Jens Axboe
2019-05-11 17:08   ` [PATCH 1/1] io_uring: fix race condition reading SQE data Stefan Bühler
2019-05-13 15:15     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).