Created attachment 14487 [details] A patch file with my proposed solution. The ELF specification declares a field in the ELF header to contain the offset inside the binary at which there will be found the program headers table: phoff. Since a segment may see its in-memory size differ from its in-file size (or the binary may have holes), in-memory offsets are bound to differ too from their in-file counterparts, and hence we may commit an error using base + phoff to find the address of the phdr's, failing miserably with a segmentation fault with a perfectly valid ELF. Given that the kernel so nicely provides this piece of information in the auxiliar vector, I think it would be best to use it by default, recurring to other ways only when this field is mysteriously ommited from it or there is no auxiliar vector at all.
Patch looks ok. Ideally, we dl_phdr would be in relro section but we do not for other globals. Could you send it to libc-alpha? All patches are discussed there.
Yes, it has already been sent to the mailing list, unless I made something wrong... I don't know, this is my first time submitting a patch.
Yeah, I saw it now.
Fixed on 2.37.