summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-13 13:36:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-13 13:36:53 -0400
commita2d79c7174aeb43b13020dd53d85a7aefdd9f3e5 (patch)
tree6873d0b44b98eb8038207f0d3fa849264f0fe642 /net/socket.c
parent964a4eacef67503a1154f7e0a75f52fbdce52022 (diff)
parenta4c0b3decb33fb4a2b5ecc6234a50680f0b21e7d (diff)
Merge tag 'for-5.3/io_uring-20190711' of git://git.kernel.dk/linux-block
Pull io_uring updates from Jens Axboe: "This contains: - Support for recvmsg/sendmsg as first class opcodes. I don't envision going much further down this path, as there are plans in progress to support potentially any system call in an async fashion through io_uring. But I think it does make sense to have certain core ops available directly, especially those that can support a "try this non-blocking" flag/mode. (me) - Handle generic short reads automatically. This can happen fairly easily if parts of the buffered read is cached. Since the application needs to issue another request for the remainder, just do this internally and save kernel/user roundtrip while providing a nicer more robust API. (me) - Support for linked SQEs. This allows SQEs to depend on each other, enabling an application to eg queue a read-from-this-file,write-to-that-file pair. (me) - Fix race in stopping SQ thread (Jackie)" * tag 'for-5.3/io_uring-20190711' of git://git.kernel.dk/linux-block: io_uring: fix io_sq_thread_stop running in front of io_sq_thread io_uring: add support for recvmsg() io_uring: add support for sendmsg() io_uring: add support for sqe links io_uring: punt short reads to async context uio: make import_iovec()/compat_import_iovec() return bytes on success
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index 16449d6daeca..293d56836f01 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2222,9 +2222,10 @@ static int copy_msghdr_from_user(struct msghdr *kmsg,
2222 2222
2223 kmsg->msg_iocb = NULL; 2223 kmsg->msg_iocb = NULL;
2224 2224
2225 return import_iovec(save_addr ? READ : WRITE, 2225 err = import_iovec(save_addr ? READ : WRITE,
2226 msg.msg_iov, msg.msg_iovlen, 2226 msg.msg_iov, msg.msg_iovlen,
2227 UIO_FASTIOV, iov, &kmsg->msg_iter); 2227 UIO_FASTIOV, iov, &kmsg->msg_iter);
2228 return err < 0 ? err : 0;
2228} 2229}
2229 2230
2230static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg, 2231static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
@@ -2326,6 +2327,13 @@ out_freeiov:
2326/* 2327/*
2327 * BSD sendmsg interface 2328 * BSD sendmsg interface
2328 */ 2329 */
2330long __sys_sendmsg_sock(struct socket *sock, struct user_msghdr __user *msg,
2331 unsigned int flags)
2332{
2333 struct msghdr msg_sys;
2334
2335 return ___sys_sendmsg(sock, msg, &msg_sys, flags, NULL, 0);
2336}
2329 2337
2330long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned int flags, 2338long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned int flags,
2331 bool forbid_cmsg_compat) 2339 bool forbid_cmsg_compat)
@@ -2500,6 +2508,14 @@ out_freeiov:
2500 * BSD recvmsg interface 2508 * BSD recvmsg interface
2501 */ 2509 */
2502 2510
2511long __sys_recvmsg_sock(struct socket *sock, struct user_msghdr __user *msg,
2512 unsigned int flags)
2513{
2514 struct msghdr msg_sys;
2515
2516 return ___sys_recvmsg(sock, msg, &msg_sys, flags, 0);
2517}
2518
2503long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned int flags, 2519long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned int flags,
2504 bool forbid_cmsg_compat) 2520 bool forbid_cmsg_compat)
2505{ 2521{