This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: sigsegv dereferencing l_addr in link_map
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-help at sourceware dot org
- Date: Mon, 13 Jun 2016 09:50:58 -0300
- Subject: Re: sigsegv dereferencing l_addr in link_map
- Authentication-results: sourceware.org; auth=none
- References: <faa187fe19781ef6d0e67c582ab908e3 at carlo-kok dot com> <575EA9BE dot 1070507 at linaro dot org> <c4c706cf-c420-5f3b-ceb6-1e676793dd40 at remobjects dot com>
On 13/06/2016 09:43, Carlo Kok wrote:
>
>
> On 2016-06-13 14:40, Adhemerval Zanella wrote:
>>
>>
>> On 11/06/2016 19:12, Carlo Kok wrote:
>>> On some (ubuntu 14.04.4, libc 2.19-0ubuntu6.9) systems I'm getting a sigsegv when casting the link_map's l_addr to Elf64_Ehdr. This is something libgc does and works fine on most linux systems, but not all.
>>>
>>> What am I missing here, and if this isn't guaranteed to work, how else can I get all the loaded data segments.
>>
>> Because _DYNAMIC is not an Elf64_Ehdr on all architectures. It is defined as:
>>
>> elf/link.h
>>
>> 28 /* We use this macro to refer to ELF types independent of the native wordsize.
>> 29 `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
>> 30 #define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
>> 31 #define _ElfW(e,w,t) _ElfW_1 (e, w, _##t)
>> 32 #define _ElfW_1(e,w,t) e##w##t
>> [...]
>> 76 extern ElfW(Dyn) _DYNAMIC[];
>>
>
> Thanks. yes I was aware of that, I simplified the crashing example since the problem I was having was on x86_64.
Right, you did not specified the flags and I assumed wrong, my mistake.