[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/31] linux-user: don't adjust base of found hole
From: |
Alex Bennée |
Subject: |
[PULL 26/31] linux-user: don't adjust base of found hole |
Date: |
Wed, 12 Jan 2022 11:27:17 +0000 |
The pgb_find_hole function goes to the trouble of taking account of
both mmap_min_addr and any offset we've applied to decide the starting
address of a potential hole. This is especially important for
emulating 32bit ARM in a 32bit build as we have applied the offset to
ensure there will be space to map the ARM_COMMPAGE bellow the main
guest map (using wrapped arithmetic).
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/690
Message-Id: <20220105135009.1584676-27-alex.bennee@linaro.org>
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 8ef0626eb0..cb2f01ff01 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2339,8 +2339,7 @@ static uintptr_t pgb_find_hole(uintptr_t guest_loaddr,
uintptr_t guest_size,
brk = (uintptr_t)sbrk(0);
if (!maps) {
- ret = pgd_find_hole_fallback(guest_size, brk, align, offset);
- return ret == -1 ? -1 : ret - guest_loaddr;
+ return pgd_find_hole_fallback(guest_size, brk, align, offset);
}
/* The first hole is before the first map entry. */
@@ -2380,7 +2379,7 @@ static uintptr_t pgb_find_hole(uintptr_t guest_loaddr,
uintptr_t guest_size,
/* Record the lowest successful match. */
if (ret < 0) {
- ret = align_start - guest_loaddr;
+ ret = align_start;
}
/* If this hole contains the identity map, select it. */
if (align_start <= guest_loaddr &&
--
2.30.2
- [PULL 15/31] tests/docker: updates to alpine package list, (continued)
- [PULL 15/31] tests/docker: updates to alpine package list, Alex Bennée, 2022/01/12
- [PULL 18/31] tests/docker: auto-generate alpine.docker with lcitool, Alex Bennée, 2022/01/12
- [PULL 21/31] hw/arm: add control knob to disable kaslr_seed via DTB, Alex Bennée, 2022/01/12
- [PULL 22/31] monitor: move x-query-profile into accel/tcg to fix build, Alex Bennée, 2022/01/12
- [PULL 23/31] docs/devel: update C standard to C11, Alex Bennée, 2022/01/12
- [PULL 25/31] linux-user/elfload: add extra logging for hole finding, Alex Bennée, 2022/01/12
- [PULL 31/31] linux-user: Remove the deprecated ppc64abi32 target, Alex Bennée, 2022/01/12
- [PULL 11/31] tests/docker: auto-generate ubuntu2004.docker with lcitool, Alex Bennée, 2022/01/12
- [PULL 30/31] docker: include bison in debian-tricore-cross, Alex Bennée, 2022/01/12
- [PULL 19/31] tests/tcg: use CONFIG_LINUX_USER, not CONFIG_LINUX, Alex Bennée, 2022/01/12
- [PULL 26/31] linux-user: don't adjust base of found hole,
Alex Bennée <=
- [PULL 29/31] FreeBSD: Upgrade to 12.3 release, Alex Bennée, 2022/01/12
- [PULL 28/31] test/tcg/ppc64le: Add float reference files, Alex Bennée, 2022/01/12
- [PULL 24/31] docs/devel: more documentation on the use of suffixes, Alex Bennée, 2022/01/12
- [PULL 27/31] tests/tcg/multiarch: Read fp flags before printf, Alex Bennée, 2022/01/12
- Re: [PULL 00/31] testing/next and other misc fixes, Peter Maydell, 2022/01/12