diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2018-03-13 15:35:57 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2018-04-02 14:15:15 -0400 |
commit | e1834a329d6bb5659c14e9e537bd1f750fe3b85e (patch) | |
tree | d47326548c1db4840cefb1d4e5341df49dabdef6 /net/compat.c | |
parent | 1255e2690689ba5b72814c8df7bfd9ecf50175aa (diff) |
net: socket: move check for forbid_cmsg_compat to __sys_...msg()
The non-compat codepaths for sys_...msg() verify that MSG_CMSG_COMPAT
is not set. By moving this check to the __sys_...msg() functions
(and making it dependent on a static flag passed to this function), we
can call the __sys...msg() functions instead of the syscall functions
in all cases. __sys_recvmmsg() does not need this trickery, as the
check is handled within the do_sys_recvmmsg() function internal to
net/socket.c.
This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'net/compat.c')
-rw-r--r-- | net/compat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/compat.c b/net/compat.c index f1ec23e9dfce..5caa48987bb2 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -736,19 +736,21 @@ static unsigned char nas[21] = { | |||
736 | 736 | ||
737 | COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) | 737 | COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) |
738 | { | 738 | { |
739 | return __sys_sendmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); | 739 | return __sys_sendmsg(fd, (struct user_msghdr __user *)msg, |
740 | flags | MSG_CMSG_COMPAT, false); | ||
740 | } | 741 | } |
741 | 742 | ||
742 | COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, | 743 | COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, |
743 | unsigned int, vlen, unsigned int, flags) | 744 | unsigned int, vlen, unsigned int, flags) |
744 | { | 745 | { |
745 | return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | 746 | return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
746 | flags | MSG_CMSG_COMPAT); | 747 | flags | MSG_CMSG_COMPAT, false); |
747 | } | 748 | } |
748 | 749 | ||
749 | COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) | 750 | COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) |
750 | { | 751 | { |
751 | return __sys_recvmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); | 752 | return __sys_recvmsg(fd, (struct user_msghdr __user *)msg, |
753 | flags | MSG_CMSG_COMPAT, false); | ||
752 | } | 754 | } |
753 | 755 | ||
754 | COMPAT_SYSCALL_DEFINE4(recv, int, fd, void __user *, buf, compat_size_t, len, unsigned int, flags) | 756 | COMPAT_SYSCALL_DEFINE4(recv, int, fd, void __user *, buf, compat_size_t, len, unsigned int, flags) |