From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Chinmay Rath" <rathc@linux.ibm.com>,
qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs)
Subject: [RFC PATCH] target/ppc: don't overflow SR lookup with 64 bit vaddr
Date: Thu, 27 Nov 2025 17:19:43 +0000 [thread overview]
Message-ID: <20251127171943.3241635-1-alex.bennee@linaro.org> (raw)
One of the side effects of making vaddr always 64 bits is there are
places where we assume it is sized to the guest. As a result a simple
shift might bring in extra bits.
Using extract32 stops the crash in:
./pyvenv/bin/meson test qtest-ppc/prom-env-test
with TCI enabled but the test still hangs.
Over to you PPC maintainers ;-)
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
target/ppc/mmu-hash32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c
index 8b980a5aa90..ce9c86ceacd 100644
--- a/target/ppc/mmu-hash32.c
+++ b/target/ppc/mmu-hash32.c
@@ -342,7 +342,7 @@ bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,
}
/* 3. Look up the Segment Register */
- sr = env->sr[eaddr >> 28];
+ sr = env->sr[extract32(eaddr, 28, 4)];
/* 4. Handle direct store segments */
if (sr & SR32_T) {
--
2.47.3
next reply other threads:[~2025-11-27 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 17:19 Alex Bennée [this message]
2025-11-27 17:37 ` [RFC PATCH] target/ppc: don't overflow SR lookup with 64 bit vaddr Peter Maydell
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=20251127171943.3241635-1-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rathc@linux.ibm.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 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).