freebsd-skq/sys
Konstantin Belousov 56be1b9a7a 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
Discussed with:	cognet, glebius
Tested by:	andreast (powerpc, all 64/32bit ABI combinations, big-endian),
       marius (sparc64, big-endian)
MFC after:    2 weeks
2011-11-13 10:28:01 +00:00
..
amd64 Fix SIGATOMIC_M{IN,AX} on x86-64. These are meant to be the minimum values that are allowed in a sig_atomic_t, but it looks like they were just copied from the x86 versions, so these definitions violate the C and C++ specs. Mismatch was spotted by the libc++ test suite. 2011-11-12 20:16:06 +00:00
arm Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on 2011-11-08 10:18:07 +00:00
boot Revert some debugging printfs that crept into 223695. 2011-11-09 14:37:47 +00:00
bsm
cam Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
cddl Correct the types of the arguments to return probes of the syscall 2011-11-11 03:49:42 +00:00
compat struct timespec32: change types of tv_sec and tv_nsec fields to signed 2011-11-11 07:17:00 +00:00
conf Comment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO. 2011-11-08 23:19:22 +00:00
contrib Add missing PF_UNLOCK in pf_test 2011-10-30 14:55:00 +00:00
crypto Update Copyright. 2011-10-27 14:15:26 +00:00
ddb
dev Disable writing to the extension CYCPWR1 register. 2011-11-12 16:47:23 +00:00
fs Lock the thread lock around block that retrieves td_wmesg. Otherwise, 2011-11-09 17:15:51 +00:00
gdb
geom Major GEOM MULTIPATH class rewrite: 2011-11-12 09:52:27 +00:00
gnu Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
i386 Weaken the part of assertions added in the r227394. Only check that the 2011-11-11 04:10:36 +00:00
ia64 Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on 2011-11-08 10:18:07 +00:00
isa
kern To limit amount of the kernel memory allocated, and to optimize the 2011-11-13 10:28:01 +00:00
kgssapi Add missing break statement to make sure all 3DES etypes really are treated 2011-10-10 09:13:07 +00:00
libkern Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
mips Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on 2011-11-08 10:18:07 +00:00
modules Revert this previous commit for now - although this override unfortunately 2011-11-10 23:16:59 +00:00
net In r191367 the need for if_free_type() was removed and a new member 2011-11-11 22:57:52 +00:00
net80211 .. add missing include from an incorrect merge. 2011-11-08 14:34:01 +00:00
netatalk
netgraph In r191367 the need for if_free_type() was removed and a new member 2011-11-11 22:57:52 +00:00
netinet In r191367 the need for if_free_type() was removed and a new member 2011-11-11 22:57:52 +00:00
netinet6 Return the correct value for the IPV6_MULTICAST_HOPS getsockopt() call. 2011-11-13 02:32:10 +00:00
netipsec Add missing va_end() in an error case to clean up after va_start() 2011-10-07 21:00:26 +00:00
netipx Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
netnatm
netncp Change ncp_scan_bindery_object() to pass a constant search string. 2011-10-16 08:44:03 +00:00
netsmb Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
nfs Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
nfsclient
nfsserver
nlm Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
ofed Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
opencrypto
pc98 Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on 2011-11-08 10:18:07 +00:00
pci - Import the common MII bitbang'ing code from NetBSD and convert drivers to 2011-11-01 16:13:59 +00:00
powerpc Fix a bug where the pmap_cpu_bootstrap() ap argument could be clobbered. 2011-11-09 13:48:23 +00:00
rpc Both a crash reported on freebsd-current on Oct. 18 under the 2011-11-03 14:38:03 +00:00
security Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
sparc64 Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on 2011-11-08 10:18:07 +00:00
sys Fix kernel build breakage after r227475. I had forgotten kernels are 2011-11-12 23:17:54 +00:00
teken Link the demo application against ncursesw to make Unicode work. 2011-10-13 14:20:27 +00:00
tools Restore the comment that I removed by accident. 2011-11-09 13:26:59 +00:00
ufs Use implementation independent inoNN_t scalars for on-disk UFS structures 2011-11-09 07:48:48 +00:00
vm Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
x86 Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
xdr
xen Properly handle suspend/resume events in the Xen device 2011-09-20 23:44:34 +00:00
Makefile