All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] linux-user: don't adjust base of found hole
@ 2022-01-04 11:32 Alex Bennée
  2022-01-04 20:02 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Bennée @ 2022-01-04 11:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Laurent Vivier

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>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/690

---
v2
  - also make same adjustment to fallback
---
 linux-user/elfload.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 238979b8b6..fa9dae5f3f 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2293,8 +2293,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. */
@@ -2334,7 +2333,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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] linux-user: don't adjust base of found hole
  2022-01-04 11:32 [PATCH v2] linux-user: don't adjust base of found hole Alex Bennée
@ 2022-01-04 20:02 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2022-01-04 20:02 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Laurent Vivier

On 1/4/22 3:32 AM, Alex Bennée wrote:
> 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>
> Resolves:https://gitlab.com/qemu-project/qemu/-/issues/690
> 
> ---
> v2
>    - also make same adjustment to fallback
> ---
>   linux-user/elfload.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-04 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 11:32 [PATCH v2] linux-user: don't adjust base of found hole Alex Bennée
2022-01-04 20:02 ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.