I am trying to LD_PRELOAD functions such as mmap, read, open, clone etc…, but while some function do get LD_PRELOADed successfully, others don’t. For example mmap, read and open are perfectly being preloaded but clone is not, while I know for sure clone is being called from my program as reported by strace, since I’m using pthreads. What is the reason for clone not being LD_PRELOADed here?
I am trying to LD_PRELOAD functions such as mmap , read , open ,
Share
straceshows system calls; LD_PRELOAD overrides (C library) functions. This probably indicates that theclonesystem call is being invoked by a different function, without going through theclonefunction symbol (e.g. through internal linkage inside the C library, or invoking the system call directly).Indeed,
cloneis not a Posix library function; it is a Linux implementation detail that happens to be exposed. The man page says:Instead you should LD_PRELOAD-override
pthread_createetc.; on other platforms they may be implemented withoutclone.