qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [PATCH v2 3/9] include/exec: Replace reserved_va with max_reserved_va
Date: Mon, 20 Mar 2023 22:32:05 +0100	[thread overview]
Message-ID: <780daa3b-e096-844e-9661-a2444080afd6@linaro.org> (raw)
In-Reply-To: <20230317155455.341843-4-richard.henderson@linaro.org>

On 17/3/23 16:54, Richard Henderson wrote:
> In addition to the rename, change the semantics to be the
> last byte of the guest va, rather than the following byte.
> This avoids some overflow conditions.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/exec/cpu-all.h      | 11 ++++++++++-
>   linux-user/arm/target_cpu.h |  2 +-
>   bsd-user/main.c             | 10 +++-------
>   bsd-user/mmap.c             |  4 ++--
>   linux-user/elfload.c        | 21 +++++++++++----------
>   linux-user/main.c           | 27 +++++++++++++--------------
>   linux-user/mmap.c           |  4 ++--
>   7 files changed, 42 insertions(+), 37 deletions(-)


> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index 28135c9e6a..cf14930c30 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -283,7 +283,7 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size,
>       end_addr = start + size;
>       if (start > reserved_va - size) {
>           /* Start at the top of the address space.  */
> -        end_addr = ((reserved_va - size) & -align) + size;
> +        end_addr = ((reserved_va + 1 - size) & -align) + size;
>           looped = true;
>       }
>   
> @@ -297,7 +297,7 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size,
>                   return (abi_ulong)-1;
>               }
>               /* Re-start at the top of the address space.  */
> -            addr = end_addr = ((reserved_va - size) & -align) + size;
> +            addr = end_addr = ((reserved_va + 1 - size) & -align) + size;

Possible follow-up cleanup:

   addr = end_addr = ROUND_DOWN(reserved_va + 1 - size, align) + size;

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Better with another R-b on top ;)


  reply	other threads:[~2023-03-20 21:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 15:54 [PATCH v2 0/9] accel/tcg: Fix page_set_flags and related [#1528] Richard Henderson
2023-03-17 15:54 ` [PATCH v2 1/9] linux-user: Diagnose misaligned -R size Richard Henderson
2023-03-20 21:24   ` Philippe Mathieu-Daudé
2023-03-17 15:54 ` [PATCH v2 2/9] linux-user: Rename max_reserved_va in main Richard Henderson
2023-03-17 15:54 ` [PATCH v2 3/9] include/exec: Replace reserved_va with max_reserved_va Richard Henderson
2023-03-20 21:32   ` Philippe Mathieu-Daudé [this message]
2023-03-17 15:54 ` [PATCH v2 4/9] accel/tcg: Pass last not end to page_set_flags Richard Henderson
2023-03-17 15:54 ` [PATCH v2 5/9] accel/tcg: Pass last not end to page_reset_target_data Richard Henderson
2023-03-17 15:54 ` [PATCH v2 6/9] accel/tcg: Pass last not end to PAGE_FOR_EACH_TB Richard Henderson
2023-03-17 15:54 ` [PATCH v2 7/9] accel/tcg: Pass last not end to page_collection_lock Richard Henderson
2023-03-17 15:54 ` [PATCH v2 8/9] accel/tcg: Pass last not end to tb_invalidate_phys_page_range__locked Richard Henderson
2023-03-20 21:35   ` Philippe Mathieu-Daudé
2023-03-17 15:54 ` [PATCH v2 9/9] accel/tcg: Pass last not end to tb_invalidate_phys_range 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=780daa3b-e096-844e-9661-a2444080afd6@linaro.org \
    --to=philmd@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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).