From 889cd28520f77611e8bb714443d9a934d7a95a1d Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sun, 14 Jun 2020 14:38:40 +0000 Subject: [PATCH] Make linux(4) warn about unsupported CMSG level/type. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25255 --- sys/compat/linux/linux_socket.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 59cca17bb6eb..bb4af573f321 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1042,8 +1042,12 @@ linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, cmsg->cmsg_level = linux_to_bsd_sockopt_level(linux_cmsg.cmsg_level); if (cmsg->cmsg_type == -1 - || cmsg->cmsg_level != SOL_SOCKET) + || cmsg->cmsg_level != SOL_SOCKET) { + linux_msg(curthread, + "unsupported sendmsg cmsg level %d type %d", + linux_cmsg.cmsg_level, linux_cmsg.cmsg_type); goto bad; + } /* * Some applications (e.g. pulseaudio) attempt to @@ -1228,6 +1232,9 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, bsd_to_linux_sockopt_level(cm->cmsg_level); if (linux_cmsg->cmsg_type == -1 || cm->cmsg_level != SOL_SOCKET) { + linux_msg(curthread, + "unsupported recvmsg cmsg level %d type %d", + cm->cmsg_level, cm->cmsg_type); error = EINVAL; goto bad; }