freebsd-skq/sys
Colin Percival b6be9566d2 Fix buffer overflow in preloaded hostuuid cleaning
When a module of type "hostuuid" is provided by the loader,
prison0_init strips any trailing whitespace and ASCII control
characters by (a) adjusting the buffer length, and (b) zeroing out
the characters in question, before storing it as the system's
hostuuid.

The buffer length adjustment was correct, but the zeroing overwrote
one byte higher in memory than intended -- in the typical case,
zeroing one byte past the end of the hostuuid buffer.  Due to the
layout of buffers passed by the boot loader to the kernel, this will
be the first byte of a subsequent buffer.

This was *probably* harmless; prison0_init runs after preloaded kernel
modules have been linked and after the preloaded /boot/entropy cache
has been processed, so in both cases having the first byte overwritten
will not cause problems.  We cannot however rule out the possibility
that other objects which are preloaded by the loader could suffer from
having the first byte overwritten.

Since the zeroing does not in fact serve any purpose, remove it and
trim trailing whitespace and ASCII control characters by adjusting
the buffer length alone.

Fixes:		c3188289 Preload hostuuid for early-boot use
Reviewed by:	kevans, markj
MFC after:	3 days
2021-05-17 20:07:49 -07:00
..
amd64 x86/xen: remove PVHv1 code 2021-05-17 11:41:21 +02:00
arm regen syscall files after d51198d63b63 2021-05-13 14:09:58 -04:00
arm64 qoriq_dw_pci: disable LS1028A support 2021-05-14 10:50:17 +02:00
bsm
cam cam: turn KASSERTs into printfs for now 2021-05-16 20:19:19 +01:00
cddl fbt: Remove some handling for multiple CTF containers 2021-04-02 17:49:13 -04:00
compat regen syscall files after d51198d63b63 2021-05-13 14:09:58 -04:00
conf Make ISA_206_ATOMICS a kernel option 2021-05-17 08:46:38 -05:00
contrib zfs: restore copyright disclaimer change from 4b84b4cca 2021-04-26 22:16:50 +02:00
crypto ossl: Don't encryt/decrypt too much data for chacha20. 2021-04-01 15:49:07 -07:00
ddb fix style nit: space after if 2021-05-05 15:26:09 -06:00
dev cxgbe: Cast pointer arguments to trunc_page() to vm_offset_t. 2021-05-17 17:04:22 -07:00
dts arm64: rockchip: Add some DTSO to disable sd/mmc 2021-05-13 18:15:31 +02:00
fs NFSv4 server: Re-establish the delegation recall timeout 2021-05-16 16:40:01 -07:00
gdb gdb: report specific stop reason for watchpoints 2021-03-30 11:36:41 -03:00
geom gmultipath: make physpath distinct from the underlying providers' 2021-05-06 12:32:27 -06:00
gnu
i386 x86/xen: remove PVHv1 code 2021-05-17 11:41:21 +02:00
isa Remove more remnants of sio(4) 2021-04-07 14:33:02 -04:00
kern Fix buffer overflow in preloaded hostuuid cleaning 2021-05-17 20:07:49 -07:00
kgssapi
libkern Use '.arch_extension crc' in the arm64 crc32 code 2021-05-06 07:42:35 +00:00
mips OCF: Remove support for asymmetric cryptographic operations. 2021-04-12 14:28:43 -07:00
modules modules: Only build sdhci_fdt for arm and arm64 2021-05-13 20:23:59 +02:00
net Fix a use after free in update_rtm_from_rc(). 2021-05-14 16:06:41 +00:00
net80211
netgraph netgraph/ng_checksum: Fix double free error 2021-05-16 19:39:51 +02:00
netinet libalias: Ensure ASSERT behind varable declarations 2021-05-16 02:28:36 +02:00
netinet6 Fix mbuf leaks in various pru_send implementations 2021-05-12 13:00:09 -04:00
netipsec Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
netpfil dummynet: Remove unused code 2021-05-17 15:03:55 +02:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
opencrypto cryptodev: Fix some input validation bugs 2021-05-11 17:36:12 -04:00
powerpc powerpc: Rework IPI message processing 2021-05-17 08:26:40 -05:00
riscv riscv: Remove old qemu compatibility code 2021-04-27 16:22:04 -05:00
rpc nfsd: fix a NFSv4.1 Linux client mount stuck in CLOSE_WAIT 2021-04-27 15:32:35 -07:00
security tcp_input/syncache: acquire only read lock on PCB for SYN,!ACK packets 2021-04-12 08:25:31 -07:00
sys Fix handling of embedded symbolic links (and history lesson). 2021-05-16 17:04:11 -07:00
teken
tests Revise FIB lookups per second benchmarking routines. 2021-05-05 12:28:17 +02:00
tools makesyscalls.lua: improve generated file style(9) compliance 2021-05-13 13:59:25 -04:00
ufs Fix handling of embedded symbolic links (and history lesson). 2021-05-16 17:04:11 -07:00
vm vm: add another pager private flag 2021-05-15 20:47:29 +00:00
x86 xen: Remove leftover bits missed in commit ac3ede5371 2021-05-17 13:06:44 -04:00
xdr
xen x86/xen: remove PVHv1 code 2021-05-17 11:41:21 +02:00
Makefile