freebsd-dev/sys
Mark Johnston 26b23f07fb sendfile: Ensure that sfio->npages is initialized
We initialize sfio->npages only when some I/O is required to satisfy the
request.  However, sendfile_iodone() contains an INVARIANTS-only check
that references sfio->npages, and this check is executed even if no I/O
is performed, so the check may use an uninitialized value.

Fix the problem by initializing sfio->npages earlier.  Note that
sendfile_swapin() always initializes the page array.  In some rare cases
we need to trim the page array so ensure that sfio->npages gets updated
accordingly.

Reported by:		syzkaller (with KASAN)
Reviewed by:		kib
Sponsored by:		The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27726
2020-12-26 16:07:40 -05:00
..
amd64 Fix amd64 GENERIC-MMCCAM kernel build 2020-12-24 22:30:52 +01:00
arm ARM: Enhance common Nvidia Tegra drivers by support for Tegra210 SoC. 2020-12-26 19:13:10 +01:00
arm64 Use the base address for early arm64 page tables 2020-12-26 19:04:57 +00:00
bsm
cam ada(4): remove remainder of MD geometry translation support 2020-12-25 20:20:54 +01:00
cddl Check that the frame pointer is within the current stack. 2020-12-08 18:00:58 +00:00
compat Add ELF flag to disable ASLR stack gap. 2020-12-18 23:14:39 +00:00
conf mlphy(4)/tlphy(4): Remove obsolete drivers 2020-12-26 19:40:55 +01:00
contrib ARM: Enhance common Nvidia Tegra drivers by support for Tegra210 SoC. 2020-12-26 19:13:10 +01:00
crypto Revert r366943. It did not work as expected. 2020-12-11 00:42:53 +00:00
ddb Add a kstack_contains() helper function. 2020-12-01 17:04:46 +00:00
dev nsphy(4): Remove obsolete support for pcn(4) 2020-12-26 19:40:56 +01:00
dts
fs Add a new "tlscertname" NFS mount option. 2020-12-23 13:42:55 -08:00
gdb gdb(4): allow bulk write of registers 2020-12-23 14:37:05 -04:00
geom Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
gnu
i386 gdb(4) fix x86 signal reporting 2020-12-23 15:40:14 -04:00
isa
kern sendfile: Ensure that sfio->npages is initialized 2020-12-26 16:07:40 -05:00
kgssapi
libkern
mips mips: fix build w/ TICK_USE_MALTA_RTC defined 2020-12-25 19:47:45 +01:00
modules mlphy(4)/tlphy(4): Remove obsolete drivers 2020-12-26 19:40:55 +01:00
net Use light-weight versions of routing lookup functions in ng_netflow. 2020-12-26 11:27:38 +00:00
net80211
netgraph Use light-weight versions of routing lookup functions in ng_netflow. 2020-12-26 11:27:38 +00:00
netinet Add modular fib lookup framework. 2020-12-25 11:33:17 +00:00
netinet6 Add modular fib lookup framework. 2020-12-25 11:33:17 +00:00
netipsec
netpfil pf: Use counter(9) for pf_state byte/packet tracking 2020-12-23 12:03:21 +01:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed
opencrypto Remove the cloned file descriptors for /dev/crypto. 2020-11-25 00:10:54 +00:00
powerpc Enable ROUTE_MPATH support in GENERIC kernels. 2020-12-14 22:23:08 +00:00
riscv Skip the vm.pmap.kernel_maps sysctl by default. 2020-12-18 20:41:23 +00:00
rpc Add a new "tlscertname" NFS mount option. 2020-12-23 13:42:55 -08:00
security audit: rework AUDIT_SYSCLOSE 2020-12-17 18:52:04 +00:00
sys Add tcgetwinsize(3) and tcsetwinsize(3) to termios 2020-12-25 20:43:09 +02:00
teken
tests
tools Use a template assembly file for firmware object files. 2020-12-17 20:31:17 +00:00
ufs ffs: Avoid out-of-bounds accesses in the fs_active bitmap 2020-12-23 11:16:40 -05:00
vm Revert r368523 which fixed contig allocs waiting forever. 2020-12-15 19:38:16 +00:00
x86 x86: stop punishing VMs with low priority for TSC timecounter 2020-12-23 12:45:15 +02:00
xdr
xen
Makefile