This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR 6494 Internal error due to malformed relro header
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Thu, 26 Mar 2009 22:56:15 +1030
- Subject: PR 6494 Internal error due to malformed relro header
glibc ld.so only uses p_memsz of PT_GNU_RELRO so let's no fuss too much
if we find p_filesz doesn't match p_memsz, as in the libpthread.so
testcase given in the PR. It's a bit of a mystery how we could have
generated such a relro header in the first place.
PR 6494
* elf.c (copy_elf_program_header): Do not check that PT_GNU_RELRO
p_filesz and p_memsz are equal. Use p_memsz as the segment size.
(assign_file_positions_for_non_load_sections): Zap PT_GNU_RELRO
if we don't find matching PT_LOAD when copying.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.479
diff -u -p -r1.479 elf.c
--- bfd/elf.c 18 Mar 2009 16:26:54 -0000 1.479
+++ bfd/elf.c 26 Mar 2009 07:46:48 -0000
@@ -4683,13 +4680,11 @@ assign_file_positions_for_non_load_secti
p->p_align = 1;
p->p_flags = (lp->p_flags & ~PF_W);
}
- else if (link_info != NULL)
+ else
{
memset (p, 0, sizeof *p);
p->p_type = PT_NULL;
}
- else
- abort ();
}
else if (m->count != 0)
{
@@ -5838,14 +5833,13 @@ copy_elf_program_header (bfd *ibfd, bfd
map->p_align_valid = 1;
map->p_vaddr_offset = 0;
- if (map->p_type == PT_GNU_RELRO
- && segment->p_filesz == segment->p_memsz)
+ if (map->p_type == PT_GNU_RELRO)
{
/* The PT_GNU_RELRO segment may contain the first a few
bytes in the .got.plt section even if the whole .got.plt
section isn't in the PT_GNU_RELRO segment. We won't
change the size of the PT_GNU_RELRO segment. */
- map->p_size = segment->p_filesz;
+ map->p_size = segment->p_memsz;
map->p_size_valid = 1;
}
--
Alan Modra
Australia Development Lab, IBM