mirror of https://github.com/xqemu/xqemu.git
Avoid page_set_flags() assert in qemu-user host page protection code
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> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
46a183da76
commit
01c0bef162
13
exec.c
13
exec.c
|
@ -307,13 +307,14 @@ static void page_init(void)
|
||||||
|
|
||||||
if (h2g_valid(endaddr)) {
|
if (h2g_valid(endaddr)) {
|
||||||
endaddr = h2g(endaddr);
|
endaddr = h2g(endaddr);
|
||||||
page_set_flags(startaddr, endaddr, PAGE_RESERVED);
|
|
||||||
} else {
|
} else {
|
||||||
#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS
|
#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS
|
||||||
endaddr = ~0ul;
|
endaddr = ~0ul;
|
||||||
page_set_flags(startaddr, endaddr, PAGE_RESERVED);
|
#else
|
||||||
|
endaddr = ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS) - 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
page_set_flags(startaddr, endaddr, PAGE_RESERVED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(freep);
|
free(freep);
|
||||||
|
@ -324,11 +325,7 @@ static void page_init(void)
|
||||||
|
|
||||||
last_brk = (unsigned long)sbrk(0);
|
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");
|
f = fopen("/proc/self/maps", "r");
|
||||||
#endif
|
|
||||||
if (f) {
|
if (f) {
|
||||||
mmap_lock();
|
mmap_lock();
|
||||||
|
|
||||||
|
@ -344,7 +341,11 @@ static void page_init(void)
|
||||||
if (h2g_valid(endaddr)) {
|
if (h2g_valid(endaddr)) {
|
||||||
endaddr = h2g(endaddr);
|
endaddr = h2g(endaddr);
|
||||||
} else {
|
} else {
|
||||||
|
#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS
|
||||||
endaddr = ~0ul;
|
endaddr = ~0ul;
|
||||||
|
#else
|
||||||
|
endaddr = ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS) - 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
page_set_flags(startaddr, endaddr, PAGE_RESERVED);
|
page_set_flags(startaddr, endaddr, PAGE_RESERVED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue