diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2020-09-15 14:43:10 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2020-09-16 09:56:39 +0100 |
commit | fb730c8683807d549c4aa8dfc98e3d1d470fd784 (patch) | |
tree | 8fda933d58401e8516407bddf08a178e085b30ab /linux-user | |
parent | de39a045bd8d2b49e4f3d07976622c29d58e0bac (diff) |
linux-user: test, don't assert addr != test in pgb_reserved_va
On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Ameliorates: ee94743034
Message-Id: <20200915134317.11110-2-alex.bennee@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/elfload.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 4961e6119e..f6022fd704 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr, assert(guest_base != 0); test = g2h(0); addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0); - if (addr == MAP_FAILED) { + if (addr == MAP_FAILED || addr != test) { error_report("Unable to reserve 0x%lx bytes of virtual address " - "space (%s) for use as guest address space (check your " - "virtual memory ulimit setting or reserve less " - "using -R option)", reserved_va, strerror(errno)); + "space at %p (%s) for use as guest address space (check your" + "virtual memory ulimit setting, min_mmap_addr or reserve less " + "using -R option)", reserved_va, test, strerror(errno)); exit(EXIT_FAILURE); } - assert(addr == test); } void probe_guest_base(const char *image_name, abi_ulong guest_loaddr, |