[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-7.2.8 05/24] linux-user: Fix loaddr computation for some elf fil
From: |
Michael Tokarev |
Subject: |
[Stable-7.2.8 05/24] linux-user: Fix loaddr computation for some elf files |
Date: |
Wed, 13 Dec 2023 16:00:14 +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 c2c095d383..87895847ec 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3001,7 +3001,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-7.2.8 00/24] Patch Round-up for stable 7.2.8, freeze on 2023-12-23, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 01/24] target/arm: Fix SME FMOPA (16-bit), BFMOPA, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 06/24] tests/avocado: Replace assertEquals() for Python 3.12 compatibility, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 08/24] target/arm: Set IL bit for pauth, SVE access, BTI trap syndromes, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 02/24] hw/ide/ahci: fix legacy software reset, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 04/24] net: Update MemReentrancyGuard for NIC, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 05/24] linux-user: Fix loaddr computation for some elf files,
Michael Tokarev <=
- [Stable-7.2.8 03/24] net: Provide MemReentrancyGuard * to qemu_new_nic(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 07/24] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 12/24] hw/nvram/xlnx-efuse-ctrl: Free XlnxVersalEFuseCtrl[] "pg0-lock" array, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 09/24] hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 10/24] hw/misc/mps2-scc: Free MPS2SCC::oscclk[] array on finalize(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 11/24] hw/nvram/xlnx-efuse: Free XlnxEFuse::ro_bits[] array on finalize(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 13/24] hw/virtio: Add VirtioPCIDeviceTypeInfo::instance_finalize field, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 15/24] hw/mips/malta: Fix the malta machine on big endian hosts, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 14/24] vmdk: Don't corrupt desc file in vmdk_write_cid, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 18/24] hw/acpi/erst: Do not ignore Error* in realize handler, Michael Tokarev, 2023/12/13