Function interposition in Linux without dlsym

后端 未结 4 1186
死守一世寂寞
死守一世寂寞 2020-12-03 08:54

I\'m currently working on a project where I need to track the usage of several system calls and low-level functions like mmap, brk, sbrk

4条回答
  •  独厮守ぢ
    2020-12-03 09:20

    If you are running a host system with glibc, the libc has some internal back end to the runtime dynamic linker that I used some time ago. If I recall correctly, I think it's called '__libc_dlsym'. (To check, "$ readelf -s /usr/lib/libc.a | grep dlsym" should help.) Declare it as an externally linked function with the same arguments and return value that dlsym has and use it to wrap dlsym itself.

提交回复
热议问题