We don't expect host addresses within page_set_flags or page_check_range. --- exec.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c index bb712ec..10673fc 100644 --- a/exec.c +++ b/exec.c @@ -2327,6 +2327,14 @@ void page_set_flags(target_ulong start, target_ulong end, int flags) { target_ulong addr, len; + /* This function should never be called with addresses outside the + guest address space. If this assert fires, it probably indicates + a missing call to h2g_valid. */ +#if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS + assert(end < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)); +#endif + assert(start < end); + start = start & TARGET_PAGE_MASK; end = TARGET_PAGE_ALIGN(end); @@ -2356,6 +2364,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags) target_ulong end; target_ulong addr; + /* This function should never be called with addresses outside the + guest address space. If this assert fires, it probably indicates + a missing call to h2g_valid. */ +#if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS + assert(start < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)); +#endif + if (start + len - 1 < start) { /* We've wrapped around. */ return -1; -- 1.6.6