All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Richard Henderson <rth@twiddle.net>, qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, riku.voipio@iki.fi, laurent@vivier.eu,
	qemu-arm@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH 1/3] tcg: Fix off-by-one in assert in page_set_flags
Date: Sat, 8 Jul 2017 14:10:45 -0300	[thread overview]
Message-ID: <66bdbcf1-dd15-1e7e-bc30-d80ae6e88ffb@amsat.org> (raw)
In-Reply-To: <20170708025030.15845-2-rth@twiddle.net>

On 07/07/2017 11:50 PM, Richard Henderson wrote:
> Most of the users of page_set_flags offset (page, page + len) as
> the end points.  One might consider this an error, since the other
> users do supply an endpoint as the last byte of the region.
> 
> However, the first thing that page_set_flags does is round end UP
> to the start of the next page.  Which means computing page + len - 1
> is in the end pointless.  Therefore, accept this usage and do not
> assert when given the exact size of the vm as the endpoint.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>   accel/tcg/translate-all.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index dfb9f0d..57578a4 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -2068,7 +2068,7 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
>          guest address space.  If this assert fires, it probably indicates
>          a missing call to h2g_valid.  */
>   #if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS
> -    assert(end < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
> +    assert(end <= ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS));

worth adding a comment /* end rounded up */ ?

anyway for this tricky catch:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>   #endif
>       assert(start < end);
>       assert_memory_lock();
> 

  reply	other threads:[~2017-07-08 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-08  2:50 [Qemu-devel] [PATCH 0/3] linux-user fixes for va mapping Richard Henderson
2017-07-08  2:50 ` [Qemu-devel] [PATCH 1/3] tcg: Fix off-by-one in assert in page_set_flags Richard Henderson
2017-07-08 17:10   ` Philippe Mathieu-Daudé [this message]
2017-07-08  2:50 ` [Qemu-devel] [PATCH 2/3] linux-user: Tidy and enforce reserved_va initialization Richard Henderson
2017-10-03 16:24   ` Peter Maydell
2017-10-05 13:48     ` Richard Henderson
2017-07-08  2:50 ` [Qemu-devel] [PATCH 3/3] linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31 Richard Henderson
2017-07-08 17:12   ` [Qemu-devel] [Qemu-arm] " 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=66bdbcf1-dd15-1e7e-bc30-d80ae6e88ffb@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aurelien@aurel32.net \
    --cc=laurent@vivier.eu \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.