qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: rth@twiddle.net
Cc: aurelien@aurel32.net, afaerber@suse.de, qemu-devel@nongnu.org,
	Laurent Vivier <lvivier@redhat.com>
Subject: [Qemu-devel] [PATCH] exec: fix tlb_vaddr_to_host()
Date: Wed, 21 Sep 2016 19:06:13 +0200	[thread overview]
Message-ID: <1474477573-6386-1-git-send-email-lvivier@redhat.com> (raw)

When used in linux-user mode, tlb_vaddr_to_host(..., addr, ...))
should return "g2h(addr)", but instead it returns "g2h(vaddr)".
As "vaddr" is "typedef uint64_t", the result of "g2h(vaddr)" is
"((void *)((unsigned long)(target_ulong)(uint64_t) + guest_base))".

This bug has been found trying to run "ls" with qemu-ppc.

Fixes: "c9f82d0 ppc: Speed up dcbz"
Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 include/exec/cpu_ldst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index b573df5..6eb5fe8 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -401,7 +401,7 @@ static inline void *tlb_vaddr_to_host(CPUArchState *env, target_ulong addr,
                                       int access_type, int mmu_idx)
 {
 #if defined(CONFIG_USER_ONLY)
-    return g2h(vaddr);
+    return g2h(addr);
 #else
     int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
     CPUTLBEntry *tlbentry = &env->tlb_table[mmu_idx][index];
-- 
2.5.5

             reply	other threads:[~2016-09-21 17:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 17:06 Laurent Vivier [this message]
2016-09-22  6:57 ` [Qemu-devel] [PATCH] exec: fix tlb_vaddr_to_host() Laurent Vivier
2016-09-22  7:23 ` Aurelien Jarno

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=1474477573-6386-1-git-send-email-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).