From: Jann Horn <[email protected]>
To: Jens Axboe <[email protected]>
Cc: io-uring <[email protected]>,
kernel list <[email protected]>
Subject: io_msg_remote_post() sets up dangling pointer (but it is never accessed)?
Date: Wed, 22 Jan 2025 00:41:24 +0100 [thread overview]
Message-ID: <CAG48ez2k5+SpsvWm_Ryj8_F0vHZjYEgJLKa1M2pNpLEoj-0yRg@mail.gmail.com> (raw)
Hi!
I think the following statement in io_msg_remote_post():
req->tctx = READ_ONCE(ctx->submitter_task->io_uring);
sets req->tctx to a pointer that may immediately become dangling if
the ctx->submitter_task concurrently goes through execve() including
the call path:
begin_new_exec -> io_uring_task_cancel -> __io_uring_cancel(true) ->
io_uring_cancel_generic(true, ...) -> __io_uring_free()
However, I can't find any codepath that can actually dereference the
req->tctx of such a ring message; and I did some quick test under
KASAN, and that also did not reveal any issue.
I think the current code is probably fine, but it would be nice if we
could avoid having a potentially dangling pointer here. Can we NULL
out the req->tctx in io_msg_remote_post(), or is that actually used
for some pointer comparison or such?
next reply other threads:[~2025-01-21 23:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 23:41 Jann Horn [this message]
2025-01-21 23:44 ` io_msg_remote_post() sets up dangling pointer (but it is never accessed)? Jann Horn
2025-01-22 23:56 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAG48ez2k5+SpsvWm_Ryj8_F0vHZjYEgJLKa1M2pNpLEoj-0yRg@mail.gmail.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox