* [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code
@ 2010-03-31 21:00 Juergen Lock
2010-03-31 21:15 ` Richard Henderson
2010-04-09 20:02 ` Aurelien Jarno
0 siblings, 2 replies; 5+ messages in thread
From: Juergen Lock @ 2010-03-31 21:00 UTC (permalink / raw)
To: qemu-devel
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>
--- 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);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code
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
1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2010-03-31 21:15 UTC (permalink / raw)
To: Juergen Lock; +Cc: qemu-devel
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 <nox@jelal.kn-bremen.de>
Acked-by: Richard Henderson <rth@twiddle.net>
>
> --- 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);
> }
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code
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
2010-04-10 15:22 ` Aurelien Jarno
1 sibling, 1 reply; 5+ messages in thread
From: Aurelien Jarno @ 2010-04-09 20:02 UTC (permalink / raw)
To: Juergen Lock; +Cc: qemu-devel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code
2010-04-09 20:02 ` Aurelien Jarno
@ 2010-04-10 15:22 ` Aurelien Jarno
2010-04-10 17:45 ` Juergen Lock
0 siblings, 1 reply; 5+ messages in thread
From: Aurelien Jarno @ 2010-04-10 15:22 UTC (permalink / raw)
To: Juergen Lock; +Cc: qemu-devel
On Fri, Apr 09, 2010 at 10:02:41PM +0200, Aurelien Jarno wrote:
> 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.
>
This patch actually breaks the build on 32-bit hosts. I have reverted
it.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCHv2] Avoid page_set_flags() assert in qemu-user host page protection code
2010-04-10 15:22 ` Aurelien Jarno
@ 2010-04-10 17:45 ` Juergen Lock
0 siblings, 0 replies; 5+ messages in thread
From: Juergen Lock @ 2010-04-10 17:45 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: Juergen Lock, qemu-devel
On Sat, Apr 10, 2010 at 05:22:08PM +0200, Aurelien Jarno wrote:
> On Fri, Apr 09, 2010 at 10:02:41PM +0200, Aurelien Jarno wrote:
> > 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.
> >
>
> This patch actually breaks the build on 32-bit hosts. I have reverted
> it.
Oh dear, sorry about that. :( Should I make a new version thats
conditional on the host being 64-bit? Or do you think 32-bit hosts
also need something fixed there?
Sorry again...
Juergen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-04-10 17:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-04-10 15:22 ` Aurelien Jarno
2010-04-10 17:45 ` Juergen Lock
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).