netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Daan De Meyer <daan.j.demeyer@gmail.com>,
	Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: kernel-team@meta.com, netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v11 0/9] Add cgroup sockaddr hooks for unix sockets
Date: Wed, 11 Oct 2023 17:41:14 -0700	[thread overview]
Message-ID: <c5c662c3-61db-404c-c60f-8b23c23a5a79@linux.dev> (raw)
In-Reply-To: <20231011185113.140426-1-daan.j.demeyer@gmail.com>

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.

      parent reply	other threads:[~2023-10-12  0:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11 18:51 [PATCH bpf-next v11 0/9] Add cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 1/9] selftests/bpf: Add missing section name tests for getpeername/getsockname Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 2/9] bpf: Propagate modified uaddrlen from cgroup sockaddr programs Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 3/9] bpf: Add bpf_sock_addr_set_sun_path() to allow writing unix sockaddr from bpf Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 4/9] bpf: Implement cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 5/9] libbpf: Add support for cgroup unix socket address hooks Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 6/9] bpftool: " Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 7/9] documentation/bpf: Document " Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 8/9] selftests/bpf: Make sure mount directory exists Daan De Meyer
2023-10-11 18:51 ` [PATCH bpf-next v11 9/9] selftests/bpf: Add tests for cgroup unix socket address hooks Daan De Meyer
2023-10-12  0:40 ` [PATCH bpf-next v11 0/9] Add cgroup sockaddr hooks for unix sockets patchwork-bot+netdevbpf
2023-10-12  0:41 ` Martin KaFai Lau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5c662c3-61db-404c-c60f-8b23c23a5a79@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=daan.j.demeyer@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).