[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQ+YNPG_AZueO+J8N=1u-fmsfSBCcyh693vYmaERdpGm7w@mail.gmail.com>
Date: Tue, 9 Jun 2020 11:26:09 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Lorenz Bauer <lmb@...udflare.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Shuah Khan <shuah@...nel.org>,
Andrii Nakryiko <andriin@...com>, Roman Gushchin <guro@...com>,
kernel-team <kernel-team@...udflare.com>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf] bpf: cgroup: allow multi-attach program to replace itself
On Mon, Jun 8, 2020 at 9:22 AM Lorenz Bauer <lmb@...udflare.com> wrote:
>
> When using BPF_PROG_ATTACH to attach a program to a cgroup in
> BPF_F_ALLOW_MULTI mode, it is not possible to replace a program
> with itself. This is because the check for duplicate programs
> doesn't take the replacement program into account.
>
> Replacing a program with itself might seem weird, but it has
> some uses: first, it allows resetting the associated cgroup storage.
> Second, it makes the API consistent with the non-ALLOW_MULTI usage,
> where it is possible to replace a program with itself. Third, it
> aligns BPF_PROG_ATTACH with bpf_link, where replacing itself is
> also supported.
>
> Sice this code has been refactored a few times this change will
> only apply to v5.7 and later. Adjustments could be made to
> commit 1020c1f24a94 ("bpf: Simplify __cgroup_bpf_attach") and
> commit d7bf2c10af05 ("bpf: allocate cgroup storage entries on attaching bpf programs")
> as well as commit 324bda9e6c5a ("bpf: multi program support for cgroup+bpf")
>
> Signed-off-by: Lorenz Bauer <lmb@...udflare.com>
> Fixes: af6eea57437a ("bpf: Implement bpf_link-based cgroup BPF program attachment")
Applied. Thanks
Powered by blists - more mailing lists