lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1655024280-23827-5-git-send-email-jdamato@fastly.com>
Date:   Sun, 12 Jun 2022 01:57:53 -0700
From:   Joe Damato <jdamato@...tly.com>
To:     linux-kernel@...r.kernel.org
Cc:     Joe Damato <jdamato@...tly.com>
Subject: [RFC,net-next v2 4/8] net: Add MSG_NTCOPY sendmsg flag

Add MSG_NTCOPY so that user applications can ask the kernel for a
non-temporal copy when copying data into the kernel for TX.

A simple helper is provided to set the iovec iterator copy type if
MSG_NTCOPY is set.

Signed-off-by: Joe Damato <jdamato@...tly.com>
---
 include/linux/socket.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 17311ad..98cb735 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -318,6 +318,7 @@ struct ucred {
 					  * plain text and require encryption
 					  */
 
+#define MSG_NTCOPY	0x2000000	/* Use a non-temporal copy */
 #define MSG_ZEROCOPY	0x4000000	/* Use user data in kernel path */
 #define MSG_FASTOPEN	0x20000000	/* Send data in TCP SYN */
 #define MSG_CMSG_CLOEXEC 0x40000000	/* Set close_on_exec for file
@@ -378,6 +379,14 @@ struct ucred {
 extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
 extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
 
+static inline void msg_set_iter_copy_type(struct msghdr *msg)
+{
+	if (msg->msg_flags & MSG_NTCOPY)
+		msg->msg_iter.iter_copy_type = ITER_NOCACHE_COPY;
+	else
+		msg->msg_iter.iter_copy_type = ITER_COPY;
+}
+
 struct timespec64;
 struct __kernel_timespec;
 struct old_timespec32;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ