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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240923170322.535940-1-sahandevs@gmail.com>
Date: Mon, 23 Sep 2024 20:33:22 +0330
From: Sahand <sahandevs@...il.com>
To: davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	netdev@...r.kernel.org
Cc: sahandevs@...il.com,
	jrife@...gle.com
Subject: [PATCH] net: expose __sock_sendmsg() symbol

From: Sahand Akbarzadeh <sahandevs@...il.com>

Commit 86a7e0b69bd5b812e48a20c66c2161744f3caa16 ("net: prevent rewrite
of msg_name in sock_sendmsg()") moved the original implementation of
sock_sendmsg() to __sock_sendmsg() and made sock_sendmsg() a wrapper
with extra checks. However, __sys_sendto() still uses __sock_sendmsg()
directly, causing BPF programs attached to kprobe:sock_sendmsg() to not
trigger on sendto() calls.

This patch exposes the __sock_sendmsg() symbol to allow writing BPF
programs similar to those for older kernels.

Signed-off-by: Sahand Akbarzadeh <sahandevs@...il.com>
---
 include/linux/net.h | 1 +
 net/socket.c        | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index b75bc534c..983be8a14 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -258,6 +258,7 @@ int sock_create_kern(struct net *net, int family, int type, int proto, struct so
 int sock_create_lite(int family, int type, int proto, struct socket **res);
 struct socket *sock_alloc(void);
 void sock_release(struct socket *sock);
+int __sock_sendmsg(struct socket *sock, struct msghdr *msg);
 int sock_sendmsg(struct socket *sock, struct msghdr *msg);
 int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags);
 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
diff --git a/net/socket.c b/net/socket.c
index 8d8b84fa4..5c790205d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -737,7 +737,7 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
 	return ret;
 }
 
-static int __sock_sendmsg(struct socket *sock, struct msghdr *msg)
+int __sock_sendmsg(struct socket *sock, struct msghdr *msg)
 {
 	int err = security_socket_sendmsg(sock, msg,
 					  msg_data_left(msg));
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ