From: Dominik Brodowski <linux@dominikbrodowski.net>
To: linux-kernel@vger.kernel.org
Cc: viro@ZenIV.linux.org.uk, torvalds@linux-foundation.org,
arnd@arndb.de, linux-arch@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: [PATCH 028/109] net: socket: add __compat_sys_recvmmsg() helper; remove in-kernel call to compat syscall
Date: Thu, 29 Mar 2018 13:23:05 +0200 [thread overview]
Message-ID: <20180329112426.23043-29-linux@dominikbrodowski.net> (raw)
In-Reply-To: <20180329112426.23043-1-linux@dominikbrodowski.net>
Using the net-internal helper __compat_sys_recvmmsg() allows us to avoid
the internal calls to the compat_sys_recvmmsg() syscall.
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>
---
net/compat.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/net/compat.c b/net/compat.c
index cdf5b0c1b962..7b2ae42a1598 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -787,9 +787,9 @@ COMPAT_SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, buf, compat_size_t, len
return __compat_sys_recvfrom(fd, buf, len, flags, addr, addrlen);
}
-COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
- unsigned int, vlen, unsigned int, flags,
- struct compat_timespec __user *, timeout)
+static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
+ unsigned int vlen, unsigned int flags,
+ struct compat_timespec __user *timeout)
{
int datagrams;
struct timespec ktspec;
@@ -809,6 +809,13 @@ COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
return datagrams;
}
+COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
+ unsigned int, vlen, unsigned int, flags,
+ struct compat_timespec __user *, timeout)
+{
+ return __compat_sys_recvmmsg(fd, mmsg, vlen, flags, timeout);
+}
+
COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
{
u32 a[AUDITSC_ARGS];
@@ -895,8 +902,8 @@ COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
ret = compat_sys_recvmsg(a0, compat_ptr(a1), a[2]);
break;
case SYS_RECVMMSG:
- ret = compat_sys_recvmmsg(a0, compat_ptr(a1), a[2], a[3],
- compat_ptr(a[4]));
+ ret = __compat_sys_recvmmsg(a0, compat_ptr(a1), a[2], a[3],
+ compat_ptr(a[4]));
break;
case SYS_ACCEPT4:
ret = __sys_accept4(a0, compat_ptr(a1), compat_ptr(a[2]), a[3]);
--
2.16.3
next prev parent reply other threads:[~2018-03-29 11:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 11:22 [PATCH 000/109] remove in-kernel calls to syscalls Dominik Brodowski
2018-03-29 11:22 ` [PATCH 008/109] net: socket: add __sys_recvfrom() helper; remove in-kernel call to syscall Dominik Brodowski
2018-03-29 11:22 ` [PATCH 009/109] net: socket: add __sys_sendto() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 010/109] net: socket: add __sys_accept4() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 011/109] net: socket: add __sys_socket() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 012/109] net: socket: add __sys_bind() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 013/109] net: socket: add __sys_connect() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 014/109] net: socket: add __sys_listen() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 015/109] net: socket: add __sys_getsockname() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 016/109] net: socket: add __sys_getpeername() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 017/109] net: socket: add __sys_socketpair() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 018/109] net: socket: add __sys_shutdown() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 019/109] net: socket: add __sys_setsockopt() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 020/109] net: socket: add __sys_getsockopt() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 021/109] net: socket: add do_sys_recvmmsg() " Dominik Brodowski
2018-03-29 11:22 ` [PATCH 022/109] net: socket: move check for forbid_cmsg_compat to __sys_...msg() Dominik Brodowski
2018-03-29 11:23 ` [PATCH 023/109] net: socket: replace calls to sys_send() with __sys_sendto() Dominik Brodowski
2018-03-29 11:23 ` [PATCH 024/109] net: socket: replace call to sys_recv() with __sys_recvfrom() Dominik Brodowski
2018-03-29 11:23 ` [PATCH 025/109] net: socket: add __compat_sys_recvfrom() helper; remove in-kernel call to compat syscall Dominik Brodowski
2018-03-29 11:23 ` [PATCH 026/109] net: socket: add __compat_sys_setsockopt() " Dominik Brodowski
2018-03-29 11:23 ` [PATCH 027/109] net: socket: add __compat_sys_getsockopt() " Dominik Brodowski
2018-03-29 11:23 ` Dominik Brodowski [this message]
2018-03-29 11:23 ` [PATCH 029/109] net: socket: add __compat_sys_...msg() helpers; remove in-kernel calls to compat syscalls Dominik Brodowski
2018-03-29 11:24 ` [PATCH 104/109] net: remove compat_sys_*() prototypes from net/compat.h Dominik Brodowski
2018-03-29 11:24 ` [PATCH 106/109] syscalls/x86: auto-create compat_sys_*() prototypes Dominik Brodowski
2018-03-29 14:20 ` [PATCH 000/109] remove in-kernel calls to syscalls Matthew Wilcox
2018-03-29 14:42 ` Dominik Brodowski
2018-03-29 14:46 ` David Laight
2018-03-29 14:55 ` Dominik Brodowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180329112426.23043-29-linux@dominikbrodowski.net \
--to=linux@dominikbrodowski.net \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).