freebsd-dev/sys
Stefan Eßer 53d5cc255d Fix overflow for timeout values of more than 68 years, which is the maximum
covered by sbintime (LONG_MAX seconds).

Some programs use timeout values in excess of 1000 years. The conversion
to sbintime caused wrap-around on overflow, which resulted in short or
negative timeout values. This caused long delays on sockets opened by
affected programs (e.g. OpenSSH).

Kernels compiled without -fno-strict-overflow were not affected, apparently
because the compiler tested the sign of the timeout value before performing
the multiplication that lead to overflow.

When the -fno-strict-overflow option was added to CFLAGS, this optimization
was disabled and the test was performed on the result of the multiplication.
Negative products were caught and resulted in EINVAL being returned, but
wrap-around to positive values just shortened the timeout value to the
residue of the result that could be represented by sbintime.

The fix is to cap the timeout values at the maximum that can be represented
by sbintime, which is 2^31 - 1 seconds or more than 68 years.

After this change, the kernel can be compiled with -fno-strict-overflow
with no ill effects.

MFC after:	3 days
2013-12-19 09:01:46 +00:00
..
amd64 Use vmcs_read() and vmcs_write() in preference to vmread() and vmwrite() 2013-12-18 06:24:21 +00:00
arm Fix copyright and some style(9) things. 2013-12-17 15:34:38 +00:00
boot Bump the loader version to 3.2 after various dosfs fixes (in particular). 2013-12-19 05:28:43 +00:00
bsm Change the cap_rights_t type from uint64_t to a structure that we can extend 2013-09-05 00:09:56 +00:00
cam Widen lun_id_t to 64 bits. This is a follow-on to r257345 to let the kernel 2013-12-14 22:07:40 +00:00
cddl MFV r258923: 4188 assertion failed in dmu_tx_hold_free(): dn_datablkshift != 0 2013-12-18 21:45:46 +00:00
compat Migrate the sendfile_sync structure into a public(ish) API in preparation 2013-12-01 03:53:21 +00:00
conf Revert r259045. 2013-12-15 18:13:42 +00:00
contrib Remove 'inline' from ar9300_init_pll(), it's too big to inline. 2013-11-08 16:28:00 +00:00
crypto fix broken style(9) in r258399 2013-11-23 00:28:18 +00:00
ddb
dev Commit 2/2: vendor whitespace changes to the driver. 2013-12-18 19:25:40 +00:00
fs Do not allow O_EXEC opens for fifo, return EINVAL. 2013-12-17 17:28:02 +00:00
gdb rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST 2013-07-24 09:45:31 +00:00
geom Clear some more places with potentially sensitive data. 2013-12-15 22:52:18 +00:00
gnu/fs/reiserfs
i386 Nuke symbols.raw 2013-12-17 07:47:27 +00:00
ia64 Allow pmap_remove_pages() to be called for physical maps not 2013-12-12 03:04:00 +00:00
isa
kern Fix overflow for timeout values of more than 68 years, which is the maximum 2013-12-19 09:01:46 +00:00
kgssapi
libkern Fix typo 2013-11-29 20:14:26 +00:00
mips Add an FDT DTS and MDROOT kernel configuration for BERI on NetFPGA. 2013-12-12 18:08:31 +00:00
modules split netmap code according to functions: 2013-12-15 08:37:24 +00:00
net Simplify contiguous mask checking. 2013-12-17 22:16:27 +00:00
net80211 Make sure any waiters on the scan results get notified if the scan task 2013-11-29 22:24:57 +00:00
netatalk The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
netgraph Eliminate duplicated & dead code. 2013-11-08 22:40:33 +00:00
netinet In a situation where: 2013-12-02 03:11:25 +00:00
netinet6 Free mbuf in case of error. 2013-12-17 10:53:17 +00:00
netipsec Initialize prot variable. 2013-11-11 13:19:55 +00:00
netipx The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
netnatm Provide includes that are needed in these files, and before were read 2013-10-26 18:18:50 +00:00
netpfil Add net.inet.ip.fw.dyn_keep_states sysctl which 2013-12-18 20:17:05 +00:00
netsmb Catch up with sb_timeo type change in r255138. This fixes 2013-11-08 08:44:09 +00:00
nfs The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
nfsclient For software builds, the NFS client does many small 2013-12-07 23:05:59 +00:00
nfsserver The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
nlm Intermittent crashes in the NLM (rpc.lockd) code during system 2013-09-06 23:14:31 +00:00
ofed Defer start/stop port to workqueues. 2013-12-15 07:07:13 +00:00
opencrypto Fix build with 'crypto' and 'zfs' in the same kernel. This was the path 2013-12-08 21:59:46 +00:00
pc98 Fix a typo. 2013-12-05 21:58:02 +00:00
pci Add preliminary support for RTL8168EP. 2013-10-29 05:37:05 +00:00
powerpc Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf 2013-12-17 15:11:24 +00:00
rpc Replace Sun Industry Standards Source License for Sun RPC code with a 2013-11-25 19:08:38 +00:00
security There is no sysctl with the MIB { CTL_KERN, KERN_MAXID }. 2013-12-05 21:55:10 +00:00
sparc64 Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf 2013-12-17 15:11:24 +00:00
sys - Rename tty_makedev() into tty_makedevf() and make it capable 2013-12-18 12:50:43 +00:00
teken Merge VT(9) project (a.k.a. newcons). 2013-12-05 22:38:53 +00:00
tools dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINE 2013-11-26 08:46:27 +00:00
ufs We needlessly panic when trying to flush MKDIR_PARENT dependencies. 2013-12-01 07:34:21 +00:00
vm Eliminate a redundant parameter to vm_radix_replace(). 2013-12-08 20:07:02 +00:00
x86 Use fixed-width types for all fields in MP Table structures and pack 2013-12-11 21:19:04 +00:00
xdr
xen Remove redundant redeclaration of gdtset in sys/xen/xen-os.h, to silence 2013-10-18 17:06:13 +00:00
Makefile