• M
    linux-user: fix mmap/munmap/mprotect/mremap/shmat · e530acd7
    Max Filippov 提交于
    In linux-user QEMU that runs for a target with TARGET_ABI_BITS bigger
    than L1_MAP_ADDR_SPACE_BITS an assertion in page_set_flags fires when
    mmap, munmap, mprotect, mremap or shmat is called for an address outside
    the guest address space. mmap and mprotect should return ENOMEM in such
    case.
    
    Change definition of GUEST_ADDR_MAX to always be the last valid guest
    address. Account for this change in open_self_maps.
    Add macro guest_addr_valid that verifies if the guest address is valid.
    Add function guest_range_valid that verifies if address range is within
    guest address space and does not wrap around. Use that macro in
    mmap/munmap/mprotect/mremap/shmat for error checking.
    
    Cc: qemu-stable@nongnu.org
    Cc: Riku Voipio <riku.voipio@iki.fi>
    Cc: Laurent Vivier <laurent@vivier.eu>
    Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
    Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
    e530acd7
cpu-all.h 11.9 KB