bpf: Add sockptr support for getsockopt
authorBreno Leitao <leitao@debian.org>
Mon, 16 Oct 2023 13:47:39 +0000 (06:47 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 19 Oct 2023 20:05:28 +0000 (14:05 -0600)
commita615f67e1a426f35366b8398c11f31c148e7df48
tree4e4f6688f2ea831ce503599d3880f73d60e026db
parent6ce4a93dbb5bd93bc2bdf14da63f9360a4dcd6a1
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>
include/linux/bpf-cgroup.h
kernel/bpf/cgroup.c
net/socket.c