In 2009, I reported this bug to glibc, describing the problem that exists when a program is using
select, and has its open file descriptor resource limit raised above 1024 (
FD_SETSIZE). If a network daemon starts using the
FD_CLR glibc macros on
fdset variables for descriptors larger than 1024, glibc will happily write beyond the end of the
fdset variable, producing a buffer overflow condition. (This problem had existed since the introduction of the macros, so, for decades? I figured it was long over-due to have a report opened about it.)
At the time, I was told this wasn’t going to be fixed and “every program using [select] must be considered buggy.” 2 years later still more people kept asking for this feature and continued to be told “no”.
But, as it turns out, a few months later after the most recent “no”, it got silently fixed anyway, with the bug left open as “Won’t Fix”! I’m glad Florian did some house-cleaning on the glibc bug tracker, since I’d otherwise never have noticed that this protection had been added to the ever-growing list of
I’ll still recommend everyone use
poll instead of
select, but now I won’t be so worried when I see requests to raise the open descriptor limit above 1024.
© 2014, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.