On Fri, 2012-10-12 at 16:04 +0200, Adrien Urban wrote:
> When trying to get the identity, after establishing the connection
> (connect /var/run/nslcd/socket), it uses select to wait on it. If the
> filedescriptor is over 1024, it still uses FD_SET to write outside of
> the fd_set, and calls select with a max at 1024.
> 
> The select won't have any fd to check, and will timeout.

Thanks for reporting this and providing the detailed test. I guess the
proper solution is to switch to poll() instead of select(). A smaller
change would be to implement a check to see the FD would fit in the set.

> Exemple provided with binary id. First noticed it after tracing nginx
> having *alot* of log files, and crashing less than a minute after
> starting.
> 
> Attached files :
> 
> bug.c - example of sources used to show the bug
> cli.txt - example usage, and results from previous prog
> trace.log - strace showing the select
> dpkg.txt - list of packages on a box where the trace was generated

trace.log is missing but with bug.c I can reproduce the problem easily.
Thanks.

Btw, I first couldn't reproduce the problem because I had nscd running
(which also may be a good idea in your configuration) so that is at
least a workaround in some cases.

The patch with minimal changes for the 0.7 and 0.8 branches are here:
  http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1782&view=revision
  http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1781&view=revision

With this patch the id command will still fail but it will do so quickly
and memory shouldn't be corrupted. I will work on switching to poll()
instead.

Thanks,

-- 
-- arthur - adej...@debian.org - http://people.debian.org/~adejong --

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to