Message ID | 20231011185113.140426-1-daan.j.demeyer@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Add cgroup sockaddr hooks for unix sockets | expand |
Hello: This series was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <martin.lau@kernel.org>: On Wed, 11 Oct 2023 20:51:02 +0200 you wrote: > Changes since v10: > > * Removed extra check from bpf_sock_addr_set_sun_path() again in favor of > calling unix_validate_addr() everywhere in af_unix.c before calling the hooks. > > Changes since v9: > > [...] Here is the summary with links: - [bpf-next,v11,1/9] selftests/bpf: Add missing section name tests for getpeername/getsockname https://git.kernel.org/bpf/bpf-next/c/feba7b634ef0 - [bpf-next,v11,2/9] bpf: Propagate modified uaddrlen from cgroup sockaddr programs https://git.kernel.org/bpf/bpf-next/c/fefba7d1ae19 - [bpf-next,v11,3/9] bpf: Add bpf_sock_addr_set_sun_path() to allow writing unix sockaddr from bpf https://git.kernel.org/bpf/bpf-next/c/53e380d21441 - [bpf-next,v11,4/9] bpf: Implement cgroup sockaddr hooks for unix sockets https://git.kernel.org/bpf/bpf-next/c/859051dd165e - [bpf-next,v11,5/9] libbpf: Add support for cgroup unix socket address hooks https://git.kernel.org/bpf/bpf-next/c/bf90438c78df - [bpf-next,v11,6/9] bpftool: Add support for cgroup unix socket address hooks https://git.kernel.org/bpf/bpf-next/c/8b3cba987e6d - [bpf-next,v11,7/9] documentation/bpf: Document cgroup unix socket address hooks https://git.kernel.org/bpf/bpf-next/c/3243fef6a4c0 - [bpf-next,v11,8/9] selftests/bpf: Make sure mount directory exists https://git.kernel.org/bpf/bpf-next/c/af2752ed450e - [bpf-next,v11,9/9] selftests/bpf: Add tests for cgroup unix socket address hooks https://git.kernel.org/bpf/bpf-next/c/82ab6b505e81 You are awesome, thank you!
On 10/11/23 11:51 AM, Daan De Meyer wrote: > Changes since v10: > > * Removed extra check from bpf_sock_addr_set_sun_path() again in favor of > calling unix_validate_addr() everywhere in af_unix.c before calling the hooks. > > Changes since v9: > > * Renamed bpf_sock_addr_set_unix_addr() to bpf_sock_addr_set_sun_path() and > rennamed arguments to match the new name. > * Added an extra check to bpf_sock_addr_set_sun_path() to disallow changing the > address of an unnamed unix socket. > * Removed unnecessary NULL check on uaddrlen in > __cgroup_bpf_run_filter_sock_addr(). > [ ... ] > This patch series extends the cgroup sockaddr hooks to include support for unix > sockets. To add support for unix sockets, struct bpf_sock_addr_kern is extended > to expose the socket address length to the bpf program. Along with that, a new > kfunc bpf_sock_addr_set_unix_addr() is added to safely allow modifying an > AF_UNIX sockaddr from bpf programs. > > I intend to use these new hooks in systemd to reimplement the LogNamespace= > feature, which allows running multiple instances of systemd-journald to > process the logs of different services. systemd-journald also processes > syslog messages, so currently, using log namespaces means all services running > in the same log namespace have to live in the same private mount namespace > so that systemd can mount the journal namespace's associated syslog socket > over /dev/log to properly direct syslog messages from all services running > in that log namespace to the correct systemd-journald instance. We want to > relax this requirement so that processes running in disjoint mount namespaces > can still run in the same log namespace. To achieve this, we can use these > new hooks to rewrite the socket address of any connect(), sendto(), ... > syscalls to /dev/log to the socket address of the journal namespace's syslog > socket instead, which will transparently do the redirection without requiring > use of a mount namespace and mounting over /dev/log. > > Aside from the above usecase, these hooks can more generally be used to > transparently redirect unix sockets to different addresses as required by > services. I have changed to use the "uaddr" test in patch 2 per the discussion in v10. Patch 4 in v11 was changed based on the discussion in v10 (call bpf after unix_validate_addr), so I carried Kuniyuki's reviewed-by tag from v9. Applied. Thanks.