Page MenuHome GnuPG

support more than 1024 fds.
Open, HighPublic

Description

The function _gpgme_io_select in posix-io.c uses a select call to get the file
descriptors which are ready to be processed. However select() has a limitation of only
working if fd < __FD_SETSIZE which is usually 1024. If fd > 1024 is provided process
crashes with 'buffer overflow detected'. The fix I made locally was to switch to a
poll() call instead.

Event Timeline

We can't easily solve this. For now I pushed a fix to return an error instead
of crashing. (commit 8173c4f). Thanks for reporting.

Just curious, why can you not start using poll() instead of select()?

poll is not available on all platforms and has other semantics. Thus we will
introduce new bugs. We are planning to move some of the lower level I/O stuff
to libgpg-error and in the course of this we will fix this problem.

werner renamed this task from _gpgme_io_select crashes if fd > 1024 to support more than 1024 fds..Aug 9 2016, 11:49 AM
werner removed a project: Bug Report.
werner added a project: Feature Request.

I changed this ussie to a feature request.

Hi, was there any update on this? I found the following bug [0] in libgcrypt, which we solved [1] with using poll ages ago.

It works for us fine because we do not have to bother about other platforms with different semantics, but it would be great if we could solve this systematically upstream in all the places.

I see the gpgrt has gpgrt_poll() so I would like to check if a patch rewriting the uses of select to gpgrt_poll() would be acceptable upstream or if there is some more about that to work on.

[0] https://bugzilla.redhat.com/show_bug.cgi?id=913773
[1] https://src.fedoraproject.org/rpms/libgcrypt/blob/rawhide/f/libgcrypt-1.8.4-use-poll.patch

werner raised the priority of this task from Normal to High.Mon, Oct 4, 11:08 AM