[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2f095beb-f91b-0528-48cd-bbfa8149ff90@iogearbox.net>
Date: Wed, 15 Apr 2020 14:34:06 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Andrii Nakryiko <andriin@...com>, bpf@...r.kernel.org,
netdev@...r.kernel.org, ast@...com, rdna@...com
Cc: andrii.nakryiko@...il.com, kernel-team@...com,
Song Liu <songliubraving@...com>
Subject: Re: [PATCH v3 bpf-next] libbpf: always specify expected_attach_type
on program load if supported
On 4/14/20 8:26 PM, Andrii Nakryiko wrote:
> For some types of BPF programs that utilize expected_attach_type, libbpf won't
> set load_attr.expected_attach_type, even if expected_attach_type is known from
> section definition. This was done to preserve backwards compatibility with old
> kernels that didn't recognize expected_attach_type attribute yet (which was
> added in 5e43f899b03a ("bpf: Check attach type at prog load time"). But this
> is problematic for some BPF programs that utilize never features that require
> kernel to know specific expected_attach_type (e.g., extended set of return
> codes for cgroup_skb/egress programs).
>
> This patch makes libbpf specify expected_attach_type by default, but also
> detect support for this field in kernel and not set it during program load.
> This allows to have a good metadata for bpf_program
> (e.g., bpf_program__get_extected_attach_type()), but still work with old
> kernels (for cases where it can work at all).
>
> Additionally, due to expected_attach_type being always set for recognized
> program types, bpf_program__attach_cgroup doesn't have to do extra checks to
> determine correct attach type, so remove that additional logic.
>
> Also adjust section_names selftest to account for this change.
>
> More detailed discussion can be found in [0].
>
> [0] https://lore.kernel.org/bpf/20200412003604.GA15986@rdna-mbp.dhcp.thefacebook.com/
>
> Reported-by: Andrey Ignatov <rdna@...com>
> Acked-by: Song Liu <songliubraving@...com>
> Acked-by: Andrey Ignatov <rdna@...com>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
Applied (to bpf), thanks!
Powered by blists - more mailing lists