aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2022-01-05 13:50:01 +0000
committerAlex Bennée <alex.bennee@linaro.org>2022-01-18 16:44:16 +0000
commit190674f3719d7a26387715952312f6397cddfaaf (patch)
tree8d098db4736c706970675e120d052ea69f8f7d4f /linux-user
parente7588237ce8f8115b5ad9a3ecdd46f60d95a461a (diff)
linux-user: don't adjust base of found hole
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>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/elfload.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 30dbb005c2..99829faf89 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 &&