summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2018-03-13 14:18:52 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2018-04-02 14:15:05 -0400
commit211b634b7f1ebc3436d5e8a34810a8eaa1f269d9 (patch)
treea5c1521dee3d5e1e0f25e8f5cb45464a703dc7fa /net
parent7a09e1eb9c1e5179797e0f3341ba7315c7626a0c (diff)
net: socket: add __sys_sendto() helper; remove in-kernel call to syscall
Using the net-internal helper __sys_sendto() allows us to avoid the internal calls to the sys_sendto() 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>
Diffstat (limited to 'net')
-rw-r--r--net/compat.c3
-rw-r--r--net/socket.c19
2 files changed, 14 insertions, 8 deletions
diff --git a/net/compat.c b/net/compat.c
index 2d8186c277b2..fc82982d9b84 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -838,7 +838,8 @@ COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
838 ret = sys_send(a0, compat_ptr(a1), a[2], a[3]); 838 ret = sys_send(a0, compat_ptr(a1), a[2], a[3]);
839 break; 839 break;
840 case SYS_SENDTO: 840 case SYS_SENDTO:
841 ret = sys_sendto(a0, compat_ptr(a1), a[2], a[3], compat_ptr(a[4]), a[5]); 841 ret = __sys_sendto(a0, compat_ptr(a1), a[2], a[3],
842 compat_ptr(a[4]), a[5]);
842 break; 843 break;
843 case SYS_RECV: 844 case SYS_RECV:
844 ret = compat_sys_recv(a0, compat_ptr(a1), a[2], a[3]); 845 ret = compat_sys_recv(a0, compat_ptr(a1), a[2], a[3]);
diff --git a/net/socket.c b/net/socket.c
index 712d99d8680f..3f037a21ba5e 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1711,10 +1711,8 @@ SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr,
1711 * space and check the user space data area is readable before invoking 1711 * space and check the user space data area is readable before invoking
1712 * the protocol. 1712 * the protocol.
1713 */ 1713 */
1714 1714int __sys_sendto(int fd, void __user *buff, size_t len, unsigned int flags,
1715SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, 1715 struct sockaddr __user *addr, int addr_len)
1716 unsigned int, flags, struct sockaddr __user *, addr,
1717 int, addr_len)
1718{ 1716{
1719 struct socket *sock; 1717 struct socket *sock;
1720 struct sockaddr_storage address; 1718 struct sockaddr_storage address;
@@ -1752,6 +1750,13 @@ out:
1752 return err; 1750 return err;
1753} 1751}
1754 1752
1753SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,
1754 unsigned int, flags, struct sockaddr __user *, addr,
1755 int, addr_len)
1756{
1757 return __sys_sendto(fd, buff, len, flags, addr, addr_len);
1758}
1759
1755/* 1760/*
1756 * Send a datagram down a socket. 1761 * Send a datagram down a socket.
1757 */ 1762 */
@@ -1759,7 +1764,7 @@ out:
1759SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len, 1764SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len,
1760 unsigned int, flags) 1765 unsigned int, flags)
1761{ 1766{
1762 return sys_sendto(fd, buff, len, flags, NULL, 0); 1767 return __sys_sendto(fd, buff, len, flags, NULL, 0);
1763} 1768}
1764 1769
1765/* 1770/*
@@ -2484,8 +2489,8 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2484 err = sys_send(a0, (void __user *)a1, a[2], a[3]); 2489 err = sys_send(a0, (void __user *)a1, a[2], a[3]);
2485 break; 2490 break;
2486 case SYS_SENDTO: 2491 case SYS_SENDTO:
2487 err = sys_sendto(a0, (void __user *)a1, a[2], a[3], 2492 err = __sys_sendto(a0, (void __user *)a1, a[2], a[3],
2488 (struct sockaddr __user *)a[4], a[5]); 2493 (struct sockaddr __user *)a[4], a[5]);
2489 break; 2494 break;
2490 case SYS_RECV: 2495 case SYS_RECV:
2491 err = sys_recv(a0, (void __user *)a1, a[2], a[3]); 2496 err = sys_recv(a0, (void __user *)a1, a[2], a[3]);