opnsense-src/sys/compat
Jessica Clarke 31068ff99c 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().")
Differential Revision:	https://reviews.freebsd.org/D36554

(cherry picked from commit 7b673a2c73)
2023-01-30 19:35:53 +00:00
..
cloudabi umtx: Split umtx.h on two counterparts. 2022-06-17 22:33:15 +03:00
cloudabi32 regen syscall files after 0bd5d81f1e 2021-05-19 20:32:47 -04:00
cloudabi64 regen syscall files after 0bd5d81f1e 2021-05-19 20:32:47 -04:00
freebsd32 freebsd32: Make sendmsg match native ABI for unpadded final control message 2023-01-30 19:35:53 +00:00
ia32 Retire sv_transtrap 2022-06-17 22:35:27 +03:00
lindebugfs LinuxKPI,lindebugfs: add u8 base type and blob support 2023-01-18 13:24:15 +00:00
linprocfs linprocfs: Add net/route. 2023-01-24 10:34:29 +03:00
linsysfs linsysfs: plug set-but-not-used vars. 2022-06-17 22:33:49 +03:00
linux linuxolator: add netlink support 2023-01-26 15:27:00 +00:00
linuxkpi linuxkpi: Update struct irq_work 2023-01-24 10:08:01 +01:00
ndis compat: clean up empty lines in .c and .h files 2020-09-01 21:24:33 +00:00
x86bios Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00