qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Andrew Randrianasulu <randrianasulu@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] cputlb: cast size_t to target_ulong before using for address masks
Date: Fri, 7 Jun 2019 01:08:01 +0200	[thread overview]
Message-ID: <699f599d-86b1-ea6b-376f-2ea6ce1acd60@redhat.com> (raw)
In-Reply-To: <20190606154310.15830-1-alex.bennee@linaro.org>

On 6/6/19 5:43 PM, Alex Bennée wrote:
> While size_t is defined to happily access the biggest host object this
> isn't the case when generating masks for 64 bit guests on 32 bit
> hosts. Otherwise we end up truncating the address when we fall back to
> our unaligned helper.
> 
> Cc: Andrew Randrianasulu <randrianasulu@gmail.com>

Fixes: https://bugs.launchpad.net/qemu/+bug/1831545

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  accel/tcg/cputlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index b796ab1cbe..8f814a1a2c 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1306,7 +1306,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
>          uint64_t r1, r2;
>          unsigned shift;
>      do_unaligned_access:
> -        addr1 = addr & ~(size - 1);
> +        addr1 = addr & ~((target_ulong)size - 1);

Tricky...
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


>          addr2 = addr1 + size;
>          r1 = full_load(env, addr1, oi, retaddr);
>          r2 = full_load(env, addr2, oi, retaddr);
> 


      parent reply	other threads:[~2019-06-06 23:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 15:43 [Qemu-devel] [PATCH] cputlb: cast size_t to target_ulong before using for address masks Alex Bennée
2019-06-06 15:57 ` Andrew Randrianasulu
2019-06-06 17:04   ` Alex Bennée
2019-06-06 23:41     ` Andrew Randrianasulu
2019-06-06 16:08 ` Richard Henderson
2019-06-06 23:08 ` Philippe Mathieu-Daudé [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=699f599d-86b1-ea6b-376f-2ea6ce1acd60@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=randrianasulu@gmail.com \
    --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).