qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user ho


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code
Date: Wed, 31 Mar 2010 14:15:54 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3

On 03/31/2010 02:00 PM, Juergen Lock wrote:
> V2 that uses endaddr = end-of-guest-address-space if !h2g_valid(endaddr)
> after I found out that indeed works; and also disables the FreeBSD 6.x
> /compat/linux/proc/self/maps fallback because it can return partial lines
> if (at least I think that's the reason) the mappings change between
> subsequent read() calls.
> 
> Signed-off-by: Juergen Lock <address@hidden>

Acked-by: Richard Henderson <address@hidden>

> 
> --- a/exec.c
> +++ b/exec.c
> @@ -306,13 +306,14 @@ static void page_init(void)
>  
>                      if (h2g_valid(endaddr)) {
>                          endaddr = h2g(endaddr);
> -                        page_set_flags(startaddr, endaddr, PAGE_RESERVED);
>                      } else {
>  #if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS
>                          endaddr = ~0ul;
> -                        page_set_flags(startaddr, endaddr, PAGE_RESERVED);
> +#else
> +                        endaddr = ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS) - 
> 1;
>  #endif
>                      }
> +                    page_set_flags(startaddr, endaddr, PAGE_RESERVED);
>                  }
>              }
>              free(freep);
> @@ -323,11 +324,7 @@ static void page_init(void)
>  
>          last_brk = (unsigned long)sbrk(0);
>  
> -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
> defined(__DragonFly__)
> -        f = fopen("/compat/linux/proc/self/maps", "r");
> -#else
>          f = fopen("/proc/self/maps", "r");
> -#endif
>          if (f) {
>              mmap_lock();
>  
> @@ -343,7 +340,11 @@ static void page_init(void)
>                      if (h2g_valid(endaddr)) {
>                          endaddr = h2g(endaddr);
>                      } else {
> +#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS
>                          endaddr = ~0ul;
> +#else
> +                        endaddr = ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS) - 
> 1;
> +#endif
>                      }
>                      page_set_flags(startaddr, endaddr, PAGE_RESERVED);
>                  }
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]