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 <raghu@mips.com>
This commit is contained in:
Chris Dearman
2011-03-10 10:48:14 -08:00
committed by Raghu Gandham
parent fed58049d5
commit db4bce0549

View File

@@ -822,7 +822,7 @@ get_lib_extents(int fd, const char *name, void *__hdr, unsigned *total_sz)
static int reserve_mem_region(soinfo *si) static int reserve_mem_region(soinfo *si)
{ {
void *base = mmap((void *)si->base, si->size, PROT_READ | PROT_EXEC, 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) { if (base == MAP_FAILED) {
DL_ERR("%5d can NOT map (%sprelinked) library '%s' at 0x%08x " DL_ERR("%5d can NOT map (%sprelinked) library '%s' at 0x%08x "
"as requested, will try general pool: %d (%s)", "as requested, will try general pool: %d (%s)",