Difficulties with LD_PRELOAD and Intercepting Sendfile
becassel at uwaterloo.ca
Tue Jan 15 22:03:29 UTC 2013
We have a custom library shim that we are using to intercept libc calls from applications. We are loading this shim beneath nginx 1.2.3 using the LD_PRELOAD flag on both Linux and FreeBSD environments.
After setting env LD_PRELOAD in the nginx.conf file, our shim is able to intercept a host of libc calls including read and write (as expected). On FreeBSD, sendfile is also intercepted from nginx as expected by our shim.
On Linux however, our library is never reached when calling sendfile, even though we have verified that sendfile is being included from sys/sendfile.h (both through checking the bindings of the calls themselves using debugging tools and through tracing the code inside .../nginx-1.2.3/src/os/unix/ngx_linux_sendfile_chain.c).
Calling sendfile through other applications results in a successful redirection to our library.
I’m wondering if anyone has encountered difficulty with intercepting sendfile from nginx on Linux before, or if this is possibly an oversight on our part.
Thanks in advance for any insight,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx