Use the internal `__libc_dlopen_mode` symbol instead of `dlmopen`
authorMilian Wolff <mail@milianw.de>
Sun, 8 Jan 2017 22:33:04 +0000 (23:33 +0100)
committerMilian Wolff <mail@milianw.de>
Sun, 8 Jan 2017 22:33:04 +0000 (23:33 +0100)
commit80e610285236dbe1e14b5550f3cf3b2eefc0ca86
tree5621de54505add68c2743c8699ffde625eba608d
parent471b90a0df12ec5ebcf4cd741d56dfe5e8e58ccf
Use the internal `__libc_dlopen_mode` symbol instead of `dlmopen`

Both, `dlmopen` and `dlopen` are only available when the debugeee
application links against libdl. When that is not the case, one
could not inject heaptrack at runtime.

By instead using the libc.so internal `__libc_dlopen_mode` function,
we get rid of this limitation and we can also inject into applications
that only link against libc.so but not libdl.

This trick was found in the linux-inject project:
https://github.com/gaffe23/linux-inject
heaptrack.sh.cmake