From: Aurelien Jarno <aurelien@aurel32.net>
To: Juergen Lock <nox@jelal.kn-bremen.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code
Date: Fri, 9 Apr 2010 22:02:41 +0200 [thread overview]
Message-ID: <20100409200241.GJ21042@volta.aurel32.net> (raw)
In-Reply-To: <20100331210036.GA44152@triton8.kn-bremen.de>
On Wed, Mar 31, 2010 at 11:00:36PM +0200, 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 <nox@jelal.kn-bremen.de>
Thanks, applied.
> --- 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);
> }
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
next prev parent reply other threads:[~2010-04-09 21:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 21:00 [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code Juergen Lock
2010-03-31 21:15 ` Richard Henderson
2010-04-09 20:02 ` Aurelien Jarno [this message]
2010-04-10 15:22 ` Aurelien Jarno
2010-04-10 17:45 ` Juergen Lock
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=20100409200241.GJ21042@volta.aurel32.net \
--to=aurelien@aurel32.net \
--cc=nox@jelal.kn-bremen.de \
--cc=qemu-devel@nongnu.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 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.