From db4bce05493d09a20f1ebc0ab68c82e906327afd Mon Sep 17 00:00:00 2001 From: Chris Dearman Date: Thu, 10 Mar 2011 10:48:14 -0800 Subject: [PATCH] Use MAP_FIXED when allocating prelinked shared library regions Prelinked libraries must be mapped to a fixed address. MAP_FIXED is ignored for non-prelinked libraries (si->base==0) Signed-off-by: Raghu Gandham --- linker/linker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linker/linker.c b/linker/linker.c index c4f54f73a..00f36c07a 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -822,7 +822,7 @@ get_lib_extents(int fd, const char *name, void *__hdr, unsigned *total_sz) static int reserve_mem_region(soinfo *si) { void *base = mmap((void *)si->base, si->size, PROT_READ | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (base == MAP_FAILED) { DL_ERR("%5d can NOT map (%sprelinked) library '%s' at 0x%08x " "as requested, will try general pool: %d (%s)",