From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: iii@linux.ibm.com, deller@gmx.de, qemu-stable@nongnu.org
Subject: [PATCH 3/6] linux-user: Adjust brk for load_bias
Date: Wed, 16 Aug 2023 11:14:34 -0700 [thread overview]
Message-ID: <20230816181437.572997-4-richard.henderson@linaro.org> (raw)
In-Reply-To: <20230816181437.572997-1-richard.henderson@linaro.org>
PIE executables are usually linked at offset 0 and are
relocated somewhere during load. The hiaddr needs to
be adjusted to keep the brk next to the executable.
Cc: qemu-stable@nongnu.org
Fixes: 1f356e8c013 ("linux-user: Adjust initial brk when interpreter is close to executable")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/elfload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index ccfbf82836..ab11f141c3 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3278,7 +3278,7 @@ static void load_elf_image(const char *image_name, const ImageSource *src,
info->start_data = -1;
info->end_data = 0;
/* Usual start for brk is after all sections of the main executable. */
- info->brk = TARGET_PAGE_ALIGN(hiaddr);
+ info->brk = TARGET_PAGE_ALIGN(hiaddr + load_bias);
info->elf_flags = ehdr->e_flags;
prot_exec = PROT_EXEC;
--
2.34.1
next prev parent reply other threads:[~2023-08-16 18:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 18:14 [PATCH 0/6] linux-user: Rewrite open_self_maps Richard Henderson
2023-08-16 18:14 ` [PATCH 1/6] util/selfmap: Use dev_t and ino_t in MapInfo Richard Henderson
2023-08-17 8:52 ` Philippe Mathieu-Daudé
2023-08-16 18:14 ` [PATCH 2/6] linux-user: Use walk_memory_regions for open_self_maps Richard Henderson
2023-08-16 18:14 ` Richard Henderson [this message]
2023-08-17 8:53 ` [PATCH 3/6] linux-user: Adjust brk for load_bias Philippe Mathieu-Daudé
2023-08-18 0:16 ` Richard Henderson
2023-08-17 16:04 ` Michael Tokarev
2023-08-18 0:17 ` Richard Henderson
2024-11-26 7:11 ` [PATCH 3/6] linux-user: Adjust brk for load_bias [regression] Dominique MARTINET
2024-11-26 9:24 ` Ilya Leoshkevich
2024-11-26 9:29 ` Dominique MARTINET
2023-08-16 18:14 ` [PATCH 4/6] linux-user: Show heap address in /proc/pid/maps Richard Henderson
2023-08-21 12:07 ` Philippe Mathieu-Daudé
2023-08-16 18:14 ` [PATCH 5/6] linux-user: Remove ELF_START_MMAP and image_info.start_mmap Richard Henderson
2023-08-17 9:00 ` Philippe Mathieu-Daudé
2023-08-18 0:19 ` Richard Henderson
2023-08-18 0:35 ` Warner Losh
2023-08-16 18:14 ` [PATCH 6/6] linux-user: Show vdso address in /proc/pid/maps Richard Henderson
2023-08-21 12:07 ` Philippe Mathieu-Daudé
2023-08-16 22:25 ` [PATCH 0/6] linux-user: Rewrite open_self_maps Helge Deller
2023-08-17 17:08 ` Ilya Leoshkevich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230816181437.572997-4-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=deller@gmx.de \
--cc=iii@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).