freebsd-dev/sys/compat/freebsd32
Jessica Clarke 7b673a2c73 freebsd32: Make sendmsg match native ABI for unpadded final control message
The API says that CMSG_SPACE should be used for msg_controllen, but in
practice the native ABI allows you to only use CMSG_LEN for the final
(typically only) control message, and real-world software does this,
including Wayland. For freebsd32, this is in practice mostly harmless,
since control messages are generally used to carry file descriptors,
which are already 4 bytes in size and thus no padding is needed, but
they can carry other quantities that may not result in an aligned
length. This was discovered after CheriBSD's freebsd64 equivalent was
updated to match the freebsd32 implementation, as that uses 8 byte
alignment which does break the file descriptor use case, and thus
Wayland.

This used to be addressed by aligning buflen before the first iteration,
but that allowed unwanted invalid inputs and was lost in 1b1428dcc8,
with no safer equivalent put in its place.

Reviewed by:	brooks, kib, markj
Obtained from:	CheriBSD
Fixes:		1b1428dcc8 ("Fix a TOCTOU vulnerability in freebsd32_copyin_control().")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36554
2022-09-15 17:16:22 +01:00
..
freebsd32_abort2.c
freebsd32_capability.c fd: rename fget*_locked to fget*_noref 2022-02-22 18:53:43 +00:00
freebsd32_ioctl.c sysent: Get rid of bogus sys/sysent.h include. 2022-05-28 20:52:17 +03:00
freebsd32_ioctl.h
freebsd32_ipc.h
freebsd32_misc.c freebsd32: Make sendmsg match native ABI for unpadded final control message 2022-09-15 17:16:22 +01:00
freebsd32_misc.h
freebsd32_proto.h sysent: regen for syscallarg_t 2022-03-28 19:43:03 +01:00
freebsd32_signal.h
freebsd32_syscall.h
freebsd32_syscalls.c
freebsd32_sysent.c sysent: regen after 52a1d90c8b, posix_fadvise in capmode 2022-04-14 15:17:36 -04:00
freebsd32_systrace_args.c
freebsd32_util.h
freebsd32.h Implement shared page address randomization 2022-07-18 16:27:37 +02:00
Makefile
syscalls.conf