dlmopen in LD_PRELOAD

Florian Weimer fweimer@redhat.com
Mon Jun 17 19:02:00 GMT 2019


* Baojun Wang:

>> Does the library you load via dlmopen contain its own definition of
>> malloc, perhaps indirectly?
>
> I don't think so, though the dynamic library does depends on libc.so.

The malloc loaded from glibc's libc.so.6 should work in this scenario,
and we have tests for basic dlmopen usage to prove this.

> Also worth mentioning is if I manually patch `__get_nprocs`, which is
> called `area_get2`, then I can see the stack overflow any longer. the
> pseudo assembly used to patch `__get_nprocs`:

Hmm.  Do you have a small reproducer which only uses C libraries?

Thanks,
Florian



More information about the Libc-help mailing list