|
From: <sv...@va...> - 2013-03-29 09:57:31
|
sewardj 2013-03-29 09:57:24 +0000 (Fri, 29 Mar 2013)
New Revision: 13351
Log:
Don't assume that page size is 4K when loading PIEs. Fixes #263034.
(Dodji Seketeli, do...@re...)
Modified files:
trunk/coregrind/m_ume/elf.c
Modified: trunk/coregrind/m_ume/elf.c (+12 -9)
===================================================================
--- trunk/coregrind/m_ume/elf.c 2013-03-29 09:40:48 +00:00 (rev 13350)
+++ trunk/coregrind/m_ume/elf.c 2013-03-29 09:57:24 +00:00 (rev 13351)
@@ -334,18 +334,21 @@
become legit, which is really bad) and causes problems for
exp-ptrcheck, which assumes all numbers below 1MB are
nonpointers. So, hackily, move it above 1MB. */
- /* Later .. is appears ppc32-linux tries to put [vdso] at 1MB,
+ /* Later .. it appears ppc32-linux tries to put [vdso] at 1MB,
which totally screws things up, because nothing else can go
- there. So bump the hacky load addess along by 0x8000, to
- 0x108000. */
- /* Later .. on mips64 we can't use 0x108000, because mapelf will fail. */
-#if defined(VGP_mips64_linux)
+ there. The size of [vdso] is around 2 or 3 pages, so bump
+ the hacky load addess along by 8 * VKI_PAGE_SIZE to be safe. */
+ /* Later .. on mips64 we can't use 0x108000, because mapelf will
+ fail. */
+# if defined(VGP_mips64_linux)
if (ebase < 0x100000)
ebase = 0x100000;
-#else
- if (ebase < 0x108000)
- ebase = 0x108000;
-#endif
+# else
+ vg_assert(VKI_PAGE_SIZE >= 4096); /* stay sane */
+ ESZ(Addr) hacky_load_address = 0x100000 + 8 * VKI_PAGE_SIZE;
+ if (ebase < hacky_load_address)
+ ebase = hacky_load_address;
+# endif
}
info->phnum = e->e.e_phnum;
|