[Qemu-devel] [PATCH 06/10] linux-user: init_guest_commpage: Add a comment about size check

Luke Shumaker posted 10 patches 7 years, 10 months ago
[Qemu-devel] [PATCH 06/10] linux-user: init_guest_commpage: Add a comment about size check
Posted by Luke Shumaker 7 years, 10 months ago
From: Luke Shumaker <lukeshu@parabola.nu>

Signed-off-by: Luke Shumaker <lukeshu@parabola.nu>
---
 linux-user/elfload.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 22f2632dfa..b560f5d6fe 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -374,6 +374,11 @@ static int init_guest_commpage(unsigned long guest_base,
 
     /* If the commpage lies within the already allocated guest space,
      * then there is no way we can allocate it.
+     *
+     * You may be thinking that that this check is redundant because
+     * we already validated the guest size against MAX_RESERVED_VA;
+     * but if qemu_host_page_mask is unusually large, then
+     * test_page_addr may be lower.
      */
     if (test_page_addr >= guest_base
         && test_page_addr < (guest_base + guest_size)) {
-- 
2.15.1


Re: [Qemu-devel] [PATCH 06/10] linux-user: init_guest_commpage: Add a comment about size check
Posted by Peter Maydell 7 years, 7 months ago
On 28 December 2017 at 18:08, Luke Shumaker <lukeshu@lukeshu.com> wrote:
> From: Luke Shumaker <lukeshu@parabola.nu>
>
> Signed-off-by: Luke Shumaker <lukeshu@parabola.nu>
> ---
>  linux-user/elfload.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 22f2632dfa..b560f5d6fe 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -374,6 +374,11 @@ static int init_guest_commpage(unsigned long guest_base,
>
>      /* If the commpage lies within the already allocated guest space,
>       * then there is no way we can allocate it.
> +     *
> +     * You may be thinking that that this check is redundant because
> +     * we already validated the guest size against MAX_RESERVED_VA;
> +     * but if qemu_host_page_mask is unusually large, then
> +     * test_page_addr may be lower.
>       */
>      if (test_page_addr >= guest_base
>          && test_page_addr < (guest_base + guest_size)) {
> --

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

Re: [Qemu-devel] [PATCH 06/10] linux-user: init_guest_commpage: Add a comment about size check
Posted by Laurent Vivier 7 years, 7 months ago
Le 28/12/2017 à 19:08, Luke Shumaker a écrit :
> From: Luke Shumaker <lukeshu@parabola.nu>
> 
> Signed-off-by: Luke Shumaker <lukeshu@parabola.nu>
> ---
>  linux-user/elfload.c | 5 +++++
>  1 file changed, 5 insertions(+)

Applied to my 'linux-user-for-2.12' branch.

Thanks,
Laurent