From e4a403876d2c930248a92ea83bfad82166cd4c09 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 20 May 2021 09:51:18 +1200 Subject: [PATCH] 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 --- man2/select.2 | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/man2/select.2 b/man2/select.2 index b778c48cc..aee25c52c 100644 --- a/man2/select.2 +++ b/man2/select.2 @@ -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