public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Does dladdr1 allocate heap memory?
@ 2017-11-10 18:52 Ponnuvel Palaniyappan
  2017-11-10 21:07 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Ponnuvel Palaniyappan @ 2017-11-10 18:52 UTC (permalink / raw)
  To: libc-help

Hi,

I have a custom dlsym-like symbol resolver (dlsym allocates memory on
failure which causes problem when using my
code alongside malloc interposing libraries). Getting the struct link_map
is one of the steps and I am wondering
if I can make use of dladdr1 for that purpose. That obviously requires
dladdr1 to *not* allocate heap memory.
In my testing, it appears be heap-alloc-safe. But I am wondering if there
are any edge cases where it might not be so.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Does dladdr1 allocate heap memory?
  2017-11-10 18:52 Does dladdr1 allocate heap memory? Ponnuvel Palaniyappan
@ 2017-11-10 21:07 ` Florian Weimer
  2017-11-10 21:10   ` Ponnuvel Palaniyappan
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2017-11-10 21:07 UTC (permalink / raw)
  To: Ponnuvel Palaniyappan, libc-help

On 11/10/2017 07:52 PM, Ponnuvel Palaniyappan wrote:
> Getting the struct link_map
> is one of the steps and I am wondering
> if I can make use of dladdr1 for that purpose.

I double-checked the situation, and dladdr1 will not call malloc in case 
of an error, so you should be good.

(The code does not even install the ld.so exception handler, so it would 
not be able to catch errors anyway.)

Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Does dladdr1 allocate heap memory?
  2017-11-10 21:07 ` Florian Weimer
@ 2017-11-10 21:10   ` Ponnuvel Palaniyappan
  0 siblings, 0 replies; 3+ messages in thread
From: Ponnuvel Palaniyappan @ 2017-11-10 21:10 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-help

Thanks a lot!

On 10-Nov-2017 9:07 pm, "Florian Weimer" <fweimer@redhat.com> wrote:

> On 11/10/2017 07:52 PM, Ponnuvel Palaniyappan wrote:
>
>> Getting the struct link_map
>> is one of the steps and I am wondering
>> if I can make use of dladdr1 for that purpose.
>>
>
> I double-checked the situation, and dladdr1 will not call malloc in case
> of an error, so you should be good.
>
> (The code does not even install the ld.so exception handler, so it would
> not be able to catch errors anyway.)
>
> Florian
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-10 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10 18:52 Does dladdr1 allocate heap memory? Ponnuvel Palaniyappan
2017-11-10 21:07 ` Florian Weimer
2017-11-10 21:10   ` Ponnuvel Palaniyappan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).