This is the mail archive of the 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]

question on glibc interposition

I have a question on glibc interposition.   Should calls to an
interposed function (e.g., malloc) from within a shared library
(e.g., bind to the interposing library, as opposed
to the glibc version?

For example I have a library that interposes malloc/free/etc. and am
finding cases in the Fortran runtime library for which the
answer to the above question is “no”:

(gdb) where
#0  __GI___libc_malloc (bytes=5) at malloc.c:3030
#1  0x00007ffff76bdc28 in ?? () from /lib64/
#2  0x00007ffff7799f5d in _gfortran_string_trim () from /lib64/
#3  0x000000000046c083 in __textfile_module_MOD_open_for_read ()
#4  0x000000000046cf38 in __textfile_module_MOD_open_1 ()
#5  0x00000000004023b2 in main ()
(gdb) ^Z
(xen.x86_64)% ps
  PID TTY          TIME CMD
  556 pts/1    00:00:00 ps
29977 pts/1    00:00:00 tcsh
32580 pts/1    00:00:00 gdb
32645 pts/1    00:00:00 tonto_base.glib
(xen.x86_64)% ldd tonto_base.glibc_mmheap =>  (0x00007ffd4b69d000) => /home/caoki/work/glibc/proto/lib64/ (0x00007efeef3e5000) => /home/caoki/work/glibc/proto/lib64/ (0x00007efeef1d4000) => /lib64/ (0x00007efeeee9d000) => /home/caoki/work/glibc/proto/lib64/ (0x00007efeeeb0b000) => /lib64/ (0x00007efeee8f4000) => /lib64/ (0x00007efeee6b8000) => /home/caoki/work/glibc/proto/lib64/ (0x00007efeee305000)
	/home/caoki/work/glibc/proto/lib64/ => /lib64/ (0x00005574b1671000)
(xen.x86_64)% nm  /home/caoki/work/glibc/proto/lib64/ | grep -w T
00000000000011d0 T aligned_alloc
0000000000000e90 T calloc
0000000000000f40 T free
0000000000000e00 T malloc
0000000000000f50 T memalign
0000000000001170 T posix_memalign
0000000000001000 T realloc

The problem is that in other cases in the same process, e.g., in
the main program, calls to malloc/free/etc are bound to the interposition
library.   This doesn’t work well when a block allocated by glibc malloc
is passed to the interposition library’s version of free().

Any clues appreciated.   I will gladly supply additional information 
if requested.


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