From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <eduardo@habkost.net>
Subject: Re: [RFC PATCH] target/i386: allow access_ptr to force slow path on failed probe
Date: Tue, 13 Aug 2024 14:12:38 +0100 [thread overview]
Message-ID: <87sev8a7nd.fsf@draig.linaro.org> (raw)
In-Reply-To: <3fb9f760-4eaa-4a81-a500-89d340fc1376@linaro.org> (Richard Henderson's message of "Thu, 8 Aug 2024 09:10:09 +1000")
Richard Henderson <richard.henderson@linaro.org> writes:
> On 8/8/24 02:02, Alex Bennée wrote:
>> When we are using TCG plugin memory callbacks probe_access_internal
>> will return TLB_MMIO to force the slow path for memory access. This
>> results in probe_access returning NULL but the x86 access_ptr function
>> happily accepts an empty haddr resulting in segfault hilarity.
>> Check for an empty haddr to prevent the segfault and enable plugins
>> to
>> track all the memory operations for the x86 save/restore helpers.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2489
>> Fixes: 6d03226b42 (plugins: force slow path when plugins instrument memory ops)
>> ---
>> target/i386/tcg/access.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>> diff --git a/target/i386/tcg/access.c b/target/i386/tcg/access.c
>> index 56a1181ea5..8ea5c453a0 100644
>> --- a/target/i386/tcg/access.c
>> +++ b/target/i386/tcg/access.c
>> @@ -58,6 +58,10 @@ static void *access_ptr(X86Access *ac, vaddr addr, unsigned len)
>> assert(addr >= ac->vaddr);
>> + if (!ac->haddr1) {
>> + return NULL;
>> + }
>> +
>> #ifdef CONFIG_USER_ONLY
>> assert(offset <= ac->size1 - len);
>> return ac->haddr1 + offset;
>
> You need to remove the test_ptr macro below as well.
So we fall-back to the slow path for linux-user as well?
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-08-13 13:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 16:02 [RFC PATCH] target/i386: allow access_ptr to force slow path on failed probe Alex Bennée
2024-08-07 16:12 ` Alexandre IOOSS
2024-08-07 23:10 ` Richard Henderson
2024-08-13 13:12 ` Alex Bennée [this message]
2024-08-13 14:48 ` Richard Henderson
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=87sev8a7nd.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).