opnsense-src/sys/compat/freebsd32
Mark Johnston fea1a98ead freebsd32: Fix a double copyin in sendmsg() and recvmsg()
freebsd32_sendmsg() and freebsd32_recvmsg() both copyin the message
header twice, once directly and once in freebsd32_copyinmsghdr().  The
iovec length from the former is used when copying in msg_iov, but the
rest of the kernel uses the iovec length from the latter.  When
kern_sendit() and kern_recvit() iterate over the iovec to compute the
residual for I/O, they can therefore end up walking past the end of the
copied in iovec, either resulting in a system call error, userspace
memory corruption from uiomove() with invalid iovecs, or a kernel page
fault if the copied-in iovec is followed by an unmapped KVA region.

Reported by:	syzbot+7cc64cd0c49605acd421@syzkaller.appspotmail.com
Reviewed by:	kib, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32010
2021-09-19 13:54:16 -04:00
..
capabilities.conf syscalls.master: switch to CAPENABLED flags 2021-09-01 21:58:16 +01:00
freebsd32.h Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). 2021-08-05 23:20:42 +08:00
freebsd32_capability.c Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
freebsd32_ioctl.c Convert remaining cap_rights_init users to cap_rights_init_one 2021-01-12 13:16:10 +00:00
freebsd32_ioctl.h Move 32-bit compat support for FIODGNAME to the right place. 2018-10-26 17:59:25 +00:00
freebsd32_ipc.h compat: clean up empty lines in .c and .h files 2020-09-01 21:24:33 +00:00
freebsd32_misc.c freebsd32: Fix a double copyin in sendmsg() and recvmsg() 2021-09-19 13:54:16 -04:00
freebsd32_misc.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
freebsd32_proto.h Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
freebsd32_signal.h sys/compat: further adoption of SPDX licensing ID tags. 2017-11-27 15:13:23 +00:00
freebsd32_syscall.h Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
freebsd32_syscalls.c Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
freebsd32_sysent.c Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
freebsd32_systrace_args.c Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
freebsd32_util.h Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
Makefile syscalls.master: switch to CAPENABLED flags 2021-09-01 21:58:16 +01:00
syscalls.conf syscalls.master: switch to CAPENABLED flags 2021-09-01 21:58:16 +01:00
syscalls.master Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). 2021-08-05 23:20:42 +08:00