freebsd-skq/sys/compat/linux
markj 7a979485ab Improve handling of control message truncation.
If a recvmsg(2) or recvmmsg(2) caller doesn't provide sufficient space
for all control messages, the kernel sets MSG_CTRUNC in the message
flags to indicate truncation of the control messages.  In the case
of SCM_RIGHTS messages, however, we were failing to dispose of the
rights that had already been externalized into the recipient's file
descriptor table.  Add a new function and mbuf type to handle this
cleanup task, and use it any time we fail to copy control messages
out to the recipient.  To simplify cleanup, control message truncation
is now only performed at control message boundaries.

The change also fixes a few related bugs:
- Rights could be leaked to the recipient process if an error occurred
  while copying out a message's contents.
- We failed to set MSG_CTRUNC if the truncation occurred on a control
  message boundary, e.g., if the caller received two control messages
  and provided only the exact amount of buffer space needed for the
  first.

PR:		131876
Reviewed by:	ed (previous version)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D16561
2018-08-07 16:36:48 +00:00
..
check_error.d
check_internal_locks.d Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_common.c
linux_dtrace.h sys/compat: further adoption of SPDX licensing ID tags. 2017-11-27 15:13:23 +00:00
linux_emul.c linuxulator: deduplicate linux_exec_imgact_try 2018-04-09 17:24:01 +00:00
linux_emul.h linuxulator: deduplicate linux_exec_imgact_try 2018-04-09 17:24:01 +00:00
linux_errno.c Share Linux errno table with libsysdecode 2018-03-22 12:58:49 +00:00
linux_errno.inc Map FreeBSD EDOOFUS to Linux EINVAL 2018-04-23 18:33:26 +00:00
linux_event.c Make timespecadd(3) and friends public 2018-07-30 15:46:40 +00:00
linux_event.h Implement timerfd family syscalls. 2017-02-26 09:48:18 +00:00
linux_file.c linuxulator: do not include legacy syscalls on arm64 2018-06-15 14:41:51 +00:00
linux_file.h Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_fork.c linux_clone_thread: mark new thread as TDB_BORN. 2018-06-21 21:15:04 +00:00
linux_futex.c Make timespecadd(3) and friends public 2018-07-30 15:46:40 +00:00
linux_futex.h Fix futexes on i386 after the 4/4G split. 2018-04-24 12:50:21 +00:00
linux_getcwd.c sys/compat: further adoption of SPDX licensing ID tags. 2017-11-27 15:13:23 +00:00
linux_ioctl.c UDP: further performance improvements on tx 2018-05-23 21:02:14 +00:00
linux_ioctl.h Rationalize license text on Linuxolator files 2018-03-23 14:39:34 +00:00
linux_ipc64.h Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_ipc.c sys/linux: Fix a few potential infoleaks in Linux IPC 2018-03-03 21:14:55 +00:00
linux_ipc.h Rationalize license text on Linuxolator files 2018-03-23 14:39:34 +00:00
linux_mib.c Fix the Linux kernel version number calculation 2018-06-22 00:02:03 +00:00
linux_mib.h Rationalize license text on Linuxolator files 2018-03-23 14:39:34 +00:00
linux_misc.c Make timespecadd(3) and friends public 2018-07-30 15:46:40 +00:00
linux_misc.h Rationalize license text on Linuxolator files 2018-03-23 14:39:34 +00:00
linux_mmap.c Eliminate the overhead of gratuitous repeated reinitialization of cap_rights 2018-05-09 18:47:24 +00:00
linux_mmap.h Fix a copy/paste bug introduced during X86_64 Linuxulator work. 2016-07-10 08:22:04 +00:00
linux_persona.h Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_signal.c Linuxulator: apply style(9) to return 2018-03-12 15:35:24 +00:00
linux_signal.h Rationalize license text on Linuxolator files 2018-03-23 14:39:34 +00:00
linux_socket.c Improve handling of control message truncation. 2018-08-07 16:36:48 +00:00
linux_socket.h Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_stats.c linuxulator: do not include legacy syscalls on arm64 2018-06-15 14:41:51 +00:00
linux_sysctl.c Quiet unused fn warning for linuxulator w/o legacy syscalls 2018-06-25 19:24:50 +00:00
linux_sysproto.h sys/compat: further adoption of SPDX licensing ID tags. 2017-11-27 15:13:23 +00:00
linux_time.c Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_timer.c
linux_timer.h Use the kern_clock_nanosleep() to implement Linux clock_nanosleep() with 2017-04-02 18:16:00 +00:00
linux_uid16.c sys/compat: further adoption of SPDX licensing ID tags. 2017-11-27 15:13:23 +00:00
linux_util.c Move most of the contents of opt_compat.h to opt_global.h. 2018-04-06 17:35:35 +00:00
linux_util.h Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_vdso.c Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code. 2017-07-30 21:24:20 +00:00
linux_vdso.h Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code. 2017-07-30 21:24:20 +00:00
linux_videodev2_compat.h
linux_videodev_compat.h
linux.c Improve debugging output. 2017-02-16 10:36:00 +00:00
linux.h
stats_timing.d Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
trace_futexes.d Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00