Basically, I'm trying to figure out how PIN tracks "Image" loads using IMG_AddInstrumentFunction. The documentation says "Use this to register a call back to catch the loading of an image". (There is an imageload
pintool in source/tools/ManualExamples that uses this).
From what I understand an ELF binary that is executed(execve'd) is mmaped into memory by the kernel. If the executable has a PT_INTERP segment(pointing to something like ld-linux.so.2), it mmaps that file's segments into memory and passes control to it.
What I'm trying to figure out is : What behaviour causes PIN to recognise an "image load"?
Initially I thought it would be a set of open-fstat-mmap2-close system calls that would indicate an image load. PIN also shows that the initial executable image in the load, but as it cannot intercept mmap calls made from execve to kernel space, so I imagined that PIN would be monitoring execve's also.
However, when I tried using PIN with a UPX compressed binary on Linux(which ends up becoming stripped and statically linked), I could find no image loads at all(not even of the main executable image).
Why does this happen?