summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2023-10-16 15:47:39 +0200
committerJens Axboe <axboe@kernel.dk>2023-10-19 22:05:28 +0200
commita615f67e1a426f35366b8398c11f31c148e7df48 (patch)
tree4e4f6688f2ea831ce503599d3880f73d60e026db /net/socket.c
parentio_uring/poll: use IOU_F_TWQ_LAZY_WAKE for wakeups (diff)
downloadlinux-a615f67e1a426f35366b8398c11f31c148e7df48.tar.xz
linux-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/ZSArfLaaGcfd8LH8@gmail.com/ Signed-off-by: Breno Leitao <leitao@debian.org> Acked-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://lore.kernel.org/r/20231016134750.1381153-2-leitao@debian.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
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;