]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r227485:
authorkib <kib@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 27 Nov 2011 19:36:36 +0000 (19:36 +0000)
committerkib <kib@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 27 Nov 2011 19:36:36 +0000 (19:36 +0000)
commit50689bd3a7604295c6d6cfda244fd62481193652
tree5d54999cfbb92d5aaa3ad4fb576bcf9340c6bf07
parentbbe21242d46afbd847a27de8b8fb5eabb81247a8
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

git-svn-id: svn://svn.freebsd.org/base/stable/8@228038 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/kern/sys_generic.c