svn commit: r232856 - head/libexec/rtld-elf
Konstantin Belousov
kib at FreeBSD.org
Mon Mar 12 10:36:04 UTC 2012
Author: kib
Date: Mon Mar 12 10:36:03 2012
New Revision: 232856
URL: http://svn.freebsd.org/changeset/base/232856
Log:
When iterating over the dso program headers, the object is not initialized
yet, and object segments are not yet mapped. Only parse the notes that
appear in the first page of the dso (as it should be anyway), and use
the preloaded page content.
Reported and tested by: stass
MFC after: 20 days
Modified:
head/libexec/rtld-elf/map_object.c
Modified: head/libexec/rtld-elf/map_object.c
==============================================================================
--- head/libexec/rtld-elf/map_object.c Mon Mar 12 08:13:04 2012 (r232855)
+++ head/libexec/rtld-elf/map_object.c Mon Mar 12 10:36:03 2012 (r232856)
@@ -149,7 +149,10 @@ map_object(int fd, const char *path, con
break;
case PT_NOTE:
- note_start = (Elf_Addr)obj->relocbase + phdr->p_offset;
+ if (phdr->p_offset > PAGE_SIZE ||
+ phdr->p_offset + phdr->p_filesz > PAGE_SIZE)
+ break;
+ note_start = (Elf_Addr)(char *)hdr + phdr->p_offset;
note_end = note_start + phdr->p_filesz;
digest_notes(obj, note_start, note_end);
break;
More information about the svn-src-all
mailing list