Re: [PATCH] Fix poll() nfds check.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vadim Lobanov wrote:
Hi,

This is a trivial patch to fix the nfds check in the poll system call
implementation. Namely, OPEN_MAX no longer does anything important in
the kernel, and checking that nfds is greater than max_fdset AND greater
than OPEN_MAX therefore just seems wrong.

This brings up a slightly-tangential question: Why do the nfds checks
exist in select()/poll()? They're not strictly necessary, since bad
input will be caught later when we validate all the fds, one by one.
Furthermore, these checks optimize the handling of error cases (which
should be uncommon) while pessimizing correct usage of the syscalls
(which should be more common).


The reason for these is presumably to keep applications which uses select() to overflow their fd_sets. Unfortunately fd_set is defined in such a way that it's a static size.

Using ulimit seems like a reasonable compromise for this.

	-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux