aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorBreno Leitao <[email protected]>2023-10-16 13:47:39 +0000
committerJens Axboe <[email protected]>2023-10-19 20:05:28 +0000
commita615f67e1a426f35366b8398c11f31c148e7df48 (patch)
tree4e4f6688f2ea831ce503599d3880f73d60e026db /net/socket.c
parentio_uring/poll: use IOU_F_TWQ_LAZY_WAKE for wakeups (diff)
downloadkernel-a615f67e1a426f35366b8398c11f31c148e7df48.tar.gz
kernel-a615f67e1a426f35366b8398c11f31c148e7df48.zip
bpf: Add sockptr support for getsockopt
The whole network stack uses sockptr, and while it doesn't move to something more modern, let's use sockptr in getsockptr BPF hooks, so, it could be used by other callers. The main motivation for this change is to use it in the io_uring {g,s}etsockopt(), which will use a userspace pointer for *optval, but, a kernel value for optlen. Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Breno Leitao <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/socket.c b/net/socket.c
index c8b08b32f097..82cd6890a4f0 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2356,8 +2356,9 @@ int __sys_getsockopt(int fd, int level, int optname, char __user *optval,
if (!in_compat_syscall())
err = BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock->sk, level, optname,
- optval, optlen, max_optlen,
- err);
+ USER_SOCKPTR(optval),
+ USER_SOCKPTR(optlen),
+ max_optlen, err);
out_put:
fput_light(sock->file, fput_needed);
return err;