lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 3 Mar 2020 20:23:29 +0100
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Alexei Starovoitov <ast@...com>,
        Toke Høiland-Jørgensen 
        <toke@...hat.com>, Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 0/3] Introduce pinnable bpf_link kernel
 abstraction

On 3/3/20 4:46 PM, Alexei Starovoitov wrote:
> On 3/3/20 12:12 AM, Daniel Borkmann wrote:
>>
>> I can see the motivation for this abstraction in particular for tracing, but given
>> the goal of bpf_link is to formalize and make the various program attachment types
>> more uniform, how is this going to solve e.g. the tc/BPF case? There is no guarantee
>> that while you create a link with the prog attached to cls_bpf that someone else is
>> going to replace that qdisc underneath you, and hence you end up with the same case
>> as if you would have only pinned the program itself (and not a link). So bpf_link
>> then gives a wrong impression that something is still attached and active while it
>> is not. What is the plan for these types?
> 
> TC is not easy to handle, right, but I don't see a 'wrong impression' part. The link will keep the program attached to qdisc. The admin
> may try to remove qdisc for netdev, but that's a separate issue.
> Same thing with xdp. The link will keep xdp program attached,
> but admin may do ifconfig down and no packets will be flowing.
> Similar with cgroups. The link will keep prog attached to a cgroup,
> but admin can still do rmdir and cgroup will be in 'dying' state.
> In case of tracing there is no intermediate entity between programs
> and the kernel. In case of networking there are layers.
> Netdevs, qdiscs, etc. May be dev_hold is a way to go.

Yep, right. I mean taking tracing use-case aside, in Cilium we attach to XDP, tc,
cgroups BPF and whatnot, and we can tear down the Cilium user space agent just
fine while packets keep flowing through the BPF progs, and a later restart will
just reattach them atomically, e.g. Cilium version upgrades are usually done this
way.

This decoupling works since the attach point is already holding the reference on
the program, and if needed user space can always retrieve what has been attached
there. So the surrounding object acts like the "bpf_link" already. I think we need
to figure out what semantics an actual bpf_link should have there. Given an admin
can change qdisc/netdev/etc underneath us, and hence cause implicit detachment, I
don't know whether it would make much sense to keep surrounding objects like filter,
qdisc or even netdev alive to work around it since there's a whole dependency chain,
like in case of filter instance, it would be kept alive, but surrounding qdisc may
be dropped.

Question is, if there are no good semantics and benefits over what can be done
today with existing infra (abstracted from user space via libbpf) for the remaining
program types, perhaps it makes sense to have the pinning tracing specific only
instead of generic abstraction which only ever works for a limited number?

Thanks,
Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ