From: Richard Henderson <richard.henderson@linaro.org>
To: Pierrick Bouvier <pierrick.bouvier@linaro.org>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Gustavo Romero" <gustavo.romero@linaro.org>,
"Michael Tokarev" <mjt@tls.msk.ru>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"David Hildenbrand" <david@redhat.com>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
"Peter Xu" <peterx@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>
Subject: Re: [PATCH] system/physmem: fix use-after-free with dispatch
Date: Thu, 24 Jul 2025 09:33:52 -0700 [thread overview]
Message-ID: <b76024ad-abd6-4606-862a-41cc1d39eab1@linaro.org> (raw)
In-Reply-To: <20250724161142.2803091-1-pierrick.bouvier@linaro.org>
On 7/24/25 09:11, Pierrick Bouvier wrote:
> This patch takes a simple approach: remove the cached value creating the
> issue, and make sure we always get the current mapping for address
> space, using address_space_to_dispatch(cpu->cpu_ases[asidx].as).
> It's equivalent to qatomic_rcu_read(&as->current_map)->dispatch;
> This is not really costly, we just need two dereferences,
> including one atomic (rcu) read, which is negligible considering we are
> already on mmu slow path anyway.
We're not just on the slow path, we're on the tlb fill path, which is even rarer. Once
upon a time, memory_dispatch was used along the mmio path, but even then I think it must
have been premature optimization.
This looks like an excellent solution.
Thanks for all the detective work.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2025-07-24 16:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 16:11 [PATCH] system/physmem: fix use-after-free with dispatch Pierrick Bouvier
2025-07-24 16:14 ` Pierrick Bouvier
2025-07-24 16:33 ` Richard Henderson [this message]
2025-07-24 19:01 ` Michael Tokarev
2025-07-28 15:45 ` Philippe Mathieu-Daudé
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=b76024ad-abd6-4606-862a-41cc1d39eab1@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=david@redhat.com \
--cc=gustavo.romero@linaro.org \
--cc=manos.pitsidianakis@linaro.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mark.caveayland@nutanix.com \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).