This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sigsegv dereferencing l_addr in link_map



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]