This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: question on glibc interposition
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: "christopher dot aoki at oracle dot com" <christopher dot aoki at oracle dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 11 Feb 2018 11:36:34 +0300 (MSK)
- Subject: Re: question on glibc interposition
- Authentication-results: sourceware.org; auth=none
- References: <85D90A1D-4D34-404C-AE3D-D2864F0CAB01@oracle.com>
On Sat, 10 Feb 2018, christopher.aoki@oracle.com wrote:
> I have a question on glibc interposition. Should calls to an
> interposed function (e.g., malloc) from within a shared library
> (e.g., libgfortran.so) bind to the interposing library, as opposed
> to the glibc version?
In general yes. There are exceptions related to dlopen or libc listed
earlier in DT_NEEDED tags (check readelf -d ./tonto*), but that seems
unlikely to be your case.
To investigate your situation, have a look at LD_DEBUG functionality
as documented in 'man ld.so'. You can do something like
LD_DEBUG_OUTPUT=/tmp/lddbg.txt LD_DEBUG=all ./tonto...
and then peruse the output, or alternatively interactively in gdb like
gdb --args ./tonto...
(gdb) set env LD_DEBUG=all
(gdb) set env LD_BIND_NOT=1
(gdb) break _gfortran_string_trim
(gdb) run
[breakpoint hit]
(gdb) fin
and after that LD_DEBUG stream between the 'run' and 'fin' commands should
show you how the malloc call was bound.
Hope that helps.
Alexander