This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FD_SET and FORTIFY_SOURCE


Rich Felker <dalias@aerifal.cx> writes:

> The problem is that a large amount of otherwise-correct software uses
> malloc and out-of-bounds FD_SET arguments to work with sets larger
> than FD_SETSIZE. I have written on the issue before that the "correct"
> way to do this is allocate an array of fd_set objects and use / and %
> to address the bit rather than passing an out-of-bounds argument to
> FD_SET (which invokes UB), but some important software like libevent
> (if I remember correctly) remains wrong in this regard.

Why would software like libevent ever use select on Linux given that poll
is available?  (Indeed, looking at the source of libevent, it appears to
only use select if none of event ports, kqueue, epoll, /dev/poll, or poll
are available, and any version of glibc and Linux that isn't ancient will
have either epoll or poll.)

That doesn't remove your point in general, of course, but software that
plays games like this with select really should just switch to one of the
poll interfaces instead.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]