Commit 93d93f5f authored by Heechan Kang's avatar Heechan Kang Committed by Jens Axboe
Browse files

io_uring/waitid: clear waitid info before copying it to userspace



IORING_OP_WAITID stores its result fields in struct io_waitid::info and
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 case io_waitid_finish()
still copies iw->info to userspace, exposing stale bytes from the reused
io_kiocb command storage.

Clear the result storage during prep so the io_uring path matches the
regular waitid syscall, which uses a zero-initialized struct waitid_info.

Fixes: f31ecf67 ("io_uring: add IORING_OP_WAITID support")
Cc: stable@vger.kernel.org # 6.7+
Signed-off-by: default avatarHeechan Kang <gganji11@naver.com>
Link: https://patch.msgid.link/20260516184709.852814-1-gganji11@naver.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ccd25890
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
}