[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/8] linux-user: test, don't assert addr != test in pgb_re
From: |
Laurent Vivier |
Subject: |
Re: [PATCH v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va |
Date: |
Tue, 15 Sep 2020 17:58:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
Le 15/09/2020 à 15:43, Alex Bennée a écrit :
> 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.
>
> Ameliorates: ee94743034
> Cc: Bug 1895080 <1895080@bugs.launchpad.net>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> linux-user/elfload.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 4961e6119e24..f6022fd70493 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,
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
- [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes, Alex Bennée, 2020/09/15
- [PATCH v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va, Alex Bennée, 2020/09/15
- [PATCH v2 3/8] configure: move deprecated feature processing to supported_target, Alex Bennée, 2020/09/15
- [PATCH v2 2/8] iotests: Drop readlink -f, Alex Bennée, 2020/09/15
- [PATCH v2 4/8] configure: also skip deprecated targets with target-list-exclude, Alex Bennée, 2020/09/15
- [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic, Alex Bennée, 2020/09/15