From: Kevin Wolf <kwolf@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, Hongyan Xu <getshell@seu.edu.cn>,
Stefan Hajnoczi <stefanha@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
"Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
Subject: Re: [PATCH for-12.0] coroutine: Make yield_until_fd_readable() detach fd handler always
Date: Fri, 20 Nov 2026 18:03:09 +0100 [thread overview]
Message-ID: <awB9TbgTzxvPBeVk@redhat.com> (raw)
In-Reply-To: <20261119145311.1144878-1-peterx@redhat.com>
Am 19.11.2026 um 15:53 hat Peter Xu geschrieben:
> Hongyan reported a possible use-after-free of RDMA migration code:
>
> https://lore.kernel.org/all/20260904033130.276-1-getshell@seu.edu.cn
>
> The issue seems real, while this patch is a proposal to fix it in a simpler
> way, meanwhile it should be a problem to the yield_until_fd_readable()
> helper in general, so it should make more sense to be fixed there too.
>
> The problem is about the use of the stack allocated FDYieldUntilData where
> we must make sure after yield_until_fd_readable() returns it's not used
> anywhere. If the coroutine yielded can be entered from outside of this
> helper (fd_coroutine_enter()), then the aio handler might be installed even
> after yield_until_fd_readable() returns, and that makes the stack variable
> accessible by aio codd, even if stack gone.
>
> Fix it by moving the aio handler removal outside the handler.
>
> Reported-by: Hongyan Xu <getshell@seu.edu.cn>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Fabiano Rosas <farosas@suse.de>
> Cc: Zhijian Li (Fujitsu) <lizhijian@fujitsu.com>
> Cc: Hongyan Xu <getshell@seu.edu.cn>
> Signed-off-by: Peter Xu <peterx@redhat.com>
The fix looks right to me, however now FDYieldUntilData has two unused
fields. I suppose you could get rid of it entirely now and pass the
coroutine pointer as opaque.
Kevin
prev parent reply other threads:[~2026-11-20 17:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 14:53 [PATCH for-12.0] coroutine: Make yield_until_fd_readable() detach fd handler always Peter Xu
2026-11-19 22:29 ` Stefan Hajnoczi
2026-11-19 23:05 ` Peter Xu
2026-11-20 17:01 ` Stefan Hajnoczi
2026-11-20 17:11 ` Kevin Wolf
2026-11-20 17:03 ` Kevin Wolf [this message]
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=awB9TbgTzxvPBeVk@redhat.com \
--to=kwolf@redhat.com \
--cc=farosas@suse.de \
--cc=getshell@seu.edu.cn \
--cc=lizhijian@fujitsu.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.