diff options
author | Martin KaFai Lau <martin.lau@kernel.org> | 2022-09-01 17:28:02 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-09-02 20:34:30 -0700 |
commit | 4ff09db1b79b98b4a2a7511571c640b76cab3beb (patch) | |
tree | 4bccfceb51e4846c36c378f214a4e08582588448 /include/linux/sockptr.h | |
parent | ba74a7608dc12fbbd8ea36e660087f08a81ef26a (diff) |
bpf: net: Change sk_getsockopt() to take the sockptr_t argument
This patch changes sk_getsockopt() to take the sockptr_t argument
such that it can be used by bpf_getsockopt(SOL_SOCKET) in a
latter patch.
security_socket_getpeersec_stream() is not changed. It stays
with the __user ptr (optval.user and optlen.user) to avoid changes
to other security hooks. bpf_getsockopt(SOL_SOCKET) also does not
support SO_PEERSEC.
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20220902002802.2888419-1-kafai@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/sockptr.h')
-rw-r--r-- | include/linux/sockptr.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/sockptr.h b/include/linux/sockptr.h index d45902fb4cad..bae5e2369b4f 100644 --- a/include/linux/sockptr.h +++ b/include/linux/sockptr.h @@ -64,6 +64,11 @@ static inline int copy_to_sockptr_offset(sockptr_t dst, size_t offset, return 0; } +static inline int copy_to_sockptr(sockptr_t dst, const void *src, size_t size) +{ + return copy_to_sockptr_offset(dst, 0, src, size); +} + static inline void *memdup_sockptr(sockptr_t src, size_t len) { void *p = kmalloc_track_caller(len, GFP_USER | __GFP_NOWARN); |