Forum: NGINX Difficulties with LD_PRELOAD and Intercepting Sendfile

Posted by Ben Cassell (Guest)
on 2013-01-15 23:04
(Received via mailing list)
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,
Ben
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.