select.2: Strengthen the warning regarding the low value of FD_SETSIZE

All modern code should avoid select(2) in favor of poll(2)
or epoll(7).

For a long history of this problem, see:

https://marc.info/?l=bugtraq&m=110660879328901
    List:       bugtraq
    Subject:    SECURITY.NNOV: Multiple applications fd_set structure bitmap array index overflow
    From:       3APA3A <3APA3A () security ! nnov ! ru>
    Date:       2005-01-24 20:30:08

https://sourceware.org/legacy-ml/libc-alpha/2003-05/msg00171.html
    User-settable FD_SETSIZE and select()
    From: mtk-lists at gmx dot net
    To: libc-alpha at sources dot redhat dot com
    Date: Mon, 19 May 2003 14:49:03 +0200 (MEST)
    Subject: User-settable FD_SETSIZE and select()

https://sourceware.org/bugzilla/show_bug.cgi?id=10352

http://0pointer.net/blog/file-descriptor-limits.html
https://twitter.com/pid_eins/status/1394962183033868292

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-05-20 09:51:18 +12:00
parent 2a1ba6ae7f
commit e4a403876d
1 changed files with 12 additions and 9 deletions

View File

@ -70,6 +70,18 @@ Feature Test Macro Requirements for glibc (see
_POSIX_C_SOURCE >= 200112L
.fi
.SH DESCRIPTION
.BR "WARNING" :
.BR select ()
can monitor only file descriptors numbers that are less than
.BR FD_SETSIZE
(1024)\(eman unreasonably low limit for many modern applications\(emand
this limitation will not change.
All modern applications should instead use
.BR poll (2)
or
.BR epoll (7),
which do not suffer this limitation.
.PP
.BR select ()
allows a program to monitor multiple file descriptors,
waiting until one or more of the file descriptors become "ready"
@ -80,15 +92,6 @@ perform a corresponding I/O operation (e.g.,
or a sufficiently small
.BR write (2))
without blocking.
.PP
.BR select ()
can monitor only file descriptors numbers that are less than
.BR FD_SETSIZE ;
.BR poll (2)
and
.BR epoll (7)
do not have this limitation.
See BUGS.
.\"
.SS File descriptor sets
The principal arguments of