io_uring/waitid: clear waitid info before copying it to userspace
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jens Axboe
maintainerQuoted 25 lines · 강희찬
IORING_OP_WAITIDstores its result fields in structio_waitid::infoand later copies them to userspace siginfo. The prep path initializes the request arguments, but it does not initialize info itself.If the wait operation completes without reporting a child event, the common wait code can return without writing
wo_info. In that caseio_waitid_finish()still copiesiw->infoto userspace, exposing stale bytes from the reusedio_kiocbcommand storage.Clear the result storage during prep so the
io_uringpath matches the regular waitid syscall, which uses a zero-initialized structwaitid_info.Fixes f31ecf671ddc ("io_uring: add IORING_OP_WAITID support")Cc [email protected] # 6.7+Signed-off-by Heechan Kang <[email protected]>---
io_uring/waitid.c | 1 +1 file changed, 1 insertion(+)io_uring/waitid.c +0
-0
io_uring/waitid.c int io_waitid_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · line 280
Quoted 6 lines
io_uring/waitid.c +1
-0@@ -275,6 +275,7 @@int io_waitid_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) iw->options = READ_ONCE(sqe->file_index); iw->head = NULL; iw->infop = u64_to_user_ptr(READ_ONCE(sqe->addr2)); + memset(&iw->info, 0, sizeof(iw->info)); return 0; }
Patch looks fine, but you can't send html formatted stuff - it won't make it to the list, and it also corrupts the patch so it can't get applied. Send everything plain/text.
Signature · 1 line
Jens Axboe