]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/commit
MFC r227485:
authorkib <kib@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 27 Nov 2011 19:00:52 +0000 (19:00 +0000)
committerkib <kib@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 27 Nov 2011 19:00:52 +0000 (19:00 +0000)
commit786b93a96fe1bbe77268d79f19644a4006090b29
tree8980b7eaa2628bbe5ad734e1199272cf54eb6a06
parent1b4986cd9b91b2ed4c8dd8d5c28e13887b3f36ab
MFC r227485:
To limit amount of the kernel memory allocated, and to optimize the
iteration over the fdsets, kern_select() limits the length of the
fdsets copied in by the last valid file descriptor index. If any bit
is set in a mask above the limit, current implementation ignores the
filedescriptor, instead of returning EBADF.

Fix the issue by scanning the tails of fdset before entering the
select loop and returning EBADF if any bit above last valid
filedescriptor index is set. The performance impact of the additional
check is only imposed on the (somewhat) buggy applications that pass
bad file descriptors to select(2) or pselect(2).

PR: kern/155606, kern/162379
Approved by: re (bz)

git-svn-id: svn://svn.freebsd.org/base/releng/9.0@228034 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/kern/sys_generic.c