[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.4 06/31] linux-user: Fix loaddr computation for some elf fil
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.4 06/31] linux-user: Fix loaddr computation for some elf files |
Date: |
Tue, 12 Dec 2023 15:17:54 +0300 |
From: Richard Henderson <richard.henderson@linaro.org>
The file offset of the load segment is not relevant to the
low address, only the beginning of the virtual address page.
Cc: qemu-stable@nongnu.org
Fixes: a93934fecd4 ("elf: take phdr offset into account when calculating the
program load address")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1952
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 82d70a84c8ee42ef969a9cfddc0f5b30b16165f5)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 47170fe5d3..b1462842b6 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3093,7 +3093,7 @@ static void load_elf_image(const char *image_name, int
image_fd,
for (i = 0; i < ehdr->e_phnum; ++i) {
struct elf_phdr *eppnt = phdr + i;
if (eppnt->p_type == PT_LOAD) {
- abi_ulong a = eppnt->p_vaddr - eppnt->p_offset;
+ abi_ulong a = eppnt->p_vaddr & TARGET_PAGE_MASK;
if (a < loaddr) {
loaddr = a;
}
--
2.39.2
- [Stable-8.1.4 00/31] Patch Round-up for stable 8.1.4, freeze on 2023-12-20, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 01/31] linux-user: xtensa: fix signal delivery in FDPIC, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 02/31] target/arm: Fix SME FMOPA (16-bit), BFMOPA, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 03/31] hw/ide/ahci: fix legacy software reset, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 04/31] net: Provide MemReentrancyGuard * to qemu_new_nic(), Michael Tokarev, 2023/12/12
- [Stable-8.1.4 06/31] linux-user: Fix loaddr computation for some elf files,
Michael Tokarev <=
- [Stable-8.1.4 07/31] tests/avocado: Replace assertEquals() for Python 3.12 compatibility, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 08/31] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 05/31] net: Update MemReentrancyGuard for NIC, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 09/31] linux-user/riscv: Add Zicboz block size to hwprobe, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 10/31] hw/riscv/virt.c: do create_fdt() earlier, add finalize_fdt(), Michael Tokarev, 2023/12/12
- [Stable-8.1.4 11/31] riscv: Fix SiFive E CLINT clock frequency, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 12/31] target/riscv/cpu_helper.c: Invalid exception on MMU translation stage, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 13/31] target/riscv/cpu_helper.c: Fix mxr bit behavior, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 14/31] vmdk: Don't corrupt desc file in vmdk_write_cid, Michael Tokarev, 2023/12/12
- [Stable-8.1.4 15/31] target/arm: Set IL bit for pauth, SVE access, BTI trap syndromes, Michael Tokarev, 2023/12/12