On Thu, 2 Aug 2012 14:39:54 -0700
Steve Kargl <s...@troutmask.apl.washington.edu> wrote:

> % file /usr/local/bin/ppdpo
> /usr/local/bin/ppdpo: ELF 32-bit LSB shared object, Intel 80386, \
> version 1 (FreeBSD), dynamically linked (uses shared libs),
> FreeBSD-style,\ for FreeBSD 10.0 (1000015), stripped
> 
> % ldd /usr/local/bin/ppdpo
> /usr/local/bin/ppdpo:
> /usr/local/bin/ppdpo: signal 11
> 

It is weird that program tries to dlopen what appears to be the binary
(itself?), but that did uncover the issue. Please try attached patch,
I only very lightly tested it here.

Also available here:
http://people.freebsd.org/~kan/rtld-digest-notes.diff

-- 
Alexander Kabaev
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c
index 509a64f..350d437 100644
--- a/libexec/rtld-elf/map_object.c
+++ b/libexec/rtld-elf/map_object.c
@@ -153,7 +153,6 @@ map_object(int fd, const char *path, const struct stat *sb)
 		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;
 	}
 
@@ -292,6 +291,11 @@ map_object(int fd, const char *path, const struct stat *sb)
     obj->relro_page = obj->relocbase + trunc_page(relro_page);
     obj->relro_size = round_page(relro_size);
 
+    if (note_start < note_end)
+    {
+	digest_notes(obj, note_start, note_end);
+    }
+
     munmap(hdr, PAGE_SIZE);
     return (obj);
 

Attachment: signature.asc
Description: PGP signature

Reply via email to