[PATCH] optional setproctitle functionality

Dirk Feytons dirk.feytons at gmail.com
Tue Oct 9 07:54:09 UTC 2012


I bumped into an interesting issue. On a Linux-based embedded platform
(using a rather old uClibc toolchain) the setproctitle code interferes
with the dynamic linker when LD_LIBRARY_PATH is used and the code
tries to dlopen() a library. Apparently the linker doesn't refetch the
LD_LIBRARY_PATH variable but uses a cached pointer. However, the
setproctitle code has messed with the string data leading to a
LD_LIBRARY_PATH that has become invalid or empty.

Exact scenario:
- nginx with ngx_lua module
- My Lua code loads a Lua C module.
- The Lua VM uses dlopen() to load that module.
- The dynamic linker tries to load the dependencies.
- For those dependencies to be found I've set LD_LIBRARY_PATH but it
gets lost as described above.
- The dynamic linker fails to find a dependency and the Lua VM reports
that the module could not be loaded with the error "File not found".

So I've created a patch (against 1.3.7) to add a configure option
--without-setproctitle that allows you to disable the setproctitle
functionality. It might be considered overkill to add a configure
option for this but I'll leave that up to you to decide. I've also
only tested on Linux; I'm not sure everything still works for BSD.


Dirk F.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setproctitle.patch
Type: application/octet-stream
Size: 4036 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20121009/04b96b41/attachment.obj>

More information about the nginx-devel mailing list