bpf: Add bpf_sock_addr_set_sun_path() to allow writing unix sockaddr from bpf
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 11 Oct 2023 18:51:05 +0000 (20:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Feb 2024 00:19:04 +0000 (16:19 -0800)
commit1474a8aff1d3b160a9acc7a72e113730eb2c1bc0
tree14bfcbe0c00debf0747522d74bd50b7efb43fb0a
parent6d71331eb044c28958b89e662ea0e11a0cd57de5
bpf: Add bpf_sock_addr_set_sun_path() to allow writing unix sockaddr from bpf

[ Upstream commit 53e380d21441909b12b6e0782b77187ae4b971c4 ]

As prep for adding unix socket support to the cgroup sockaddr hooks,
let's add a kfunc bpf_sock_addr_set_sun_path() that allows modifying a unix
sockaddr from bpf. While this is already possible for AF_INET and AF_INET6,
we'll need this kfunc when we add unix socket support since modifying the
address for those requires modifying both the address and the sockaddr
length.

Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Link: https://lore.kernel.org/r/20231011185113.140426-4-daan.j.demeyer@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Stable-dep-of: c5114710c8ce ("xsk: fix usage of multi-buffer BPF helpers for ZC XDP")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/btf.c
net/core/filter.c