|
Jakub Jelinek |
4b7bde |
From eb8d355b64e72bfdf1c8dd2534b1625d5d0118e0 Mon Sep 17 00:00:00 2001
|
|
Jakub Jelinek |
4b7bde |
From: Dodji Seketeli <dodji@seketeli.org>
|
|
Jakub Jelinek |
4b7bde |
Date: Thu, 13 Jan 2011 16:04:39 +0100
|
|
Jakub Jelinek |
4b7bde |
Subject: [PATCH] Fix crash loading certain binaries on ppc64
|
|
Jakub Jelinek |
4b7bde |
|
|
Jakub Jelinek |
4b7bde |
Increase the space left for VDSO on ppc64 compiled with 64KB page
|
|
Jakub Jelinek |
4b7bde |
size. the size of VDSO is at least 2 pages: one for the code and one
|
|
Jakub Jelinek |
4b7bde |
for the data. We ought to leave more than two page space then. The
|
|
Jakub Jelinek |
4b7bde |
patch leaves 8 pages space to comply with what is done already for 4KB
|
|
Jakub Jelinek |
4b7bde |
page sizes.
|
|
Jakub Jelinek |
4b7bde |
---
|
|
Jakub Jelinek |
4b7bde |
coregrind/m_ume/elf.c | 10 ++++++----
|
|
Jakub Jelinek |
4b7bde |
1 files changed, 6 insertions(+), 4 deletions(-)
|
|
Jakub Jelinek |
4b7bde |
|
|
Jakub Jelinek |
4b7bde |
--- valgrind/coregrind/m_ume/elf.c
|
|
Jakub Jelinek |
4b7bde |
+++ valgrind/coregrind/m_ume/elf.c
|
|
Jakub Jelinek |
4b7bde |
@@ -327,6 +327,7 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
|
|
Jakub Jelinek |
4b7bde |
/* The kernel maps position-independent executables at TASK_SIZE*2/3;
|
|
Jakub Jelinek |
4b7bde |
duplicate this behavior as close as we can. */
|
|
Jakub Jelinek |
4b7bde |
if (e->e.e_type == ET_DYN && ebase == 0) {
|
|
Jakub Jelinek |
4b7bde |
+ ESZ(Addr) hacky_load_address;
|
|
Jakub Jelinek |
4b7bde |
ebase = VG_PGROUNDDN(info->exe_base
|
|
Jakub Jelinek |
4b7bde |
+ (info->exe_end - info->exe_base) * 2 / 3);
|
|
Jakub Jelinek |
4b7bde |
/* We really don't want to load PIEs at zero or too close. It
|
|
Jakub Jelinek |
4b7bde |
@@ -336,10 +337,11 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
|
|
Jakub Jelinek |
4b7bde |
nonpointers. So, hackily, move it above 1MB. */
|
|
Jakub Jelinek |
4b7bde |
/* Later .. is appears ppc32-linux tries to put [vdso] at 1MB,
|
|
Jakub Jelinek |
4b7bde |
which totally screws things up, because nothing else can go
|
|
Jakub Jelinek |
4b7bde |
- there. So bump the hacky load addess along by 0x8000, to
|
|
Jakub Jelinek |
4b7bde |
- 0x108000. */
|
|
Jakub Jelinek |
4b7bde |
- if (ebase < 0x108000)
|
|
Jakub Jelinek |
4b7bde |
- ebase = 0x108000;
|
|
Jakub Jelinek |
4b7bde |
+ there. The size of [vdso] is around 2 or 3 pages, so bump
|
|
Jakub Jelinek |
4b7bde |
+ the hacky load addess along by 8 * VKI_PAGE_SIZE to be safe. */
|
|
Jakub Jelinek |
4b7bde |
+ hacky_load_address = 0x100000 + 8 * VKI_PAGE_SIZE;
|
|
Jakub Jelinek |
4b7bde |
+ if (ebase < hacky_load_address)
|
|
Jakub Jelinek |
4b7bde |
+ ebase = hacky_load_address;
|
|
Jakub Jelinek |
4b7bde |
}
|
|
Jakub Jelinek |
4b7bde |
|
|
Jakub Jelinek |
4b7bde |
info->phnum = e->e.e_phnum;
|