[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACAyw9_RqR9m8zBTTO+qKzs9K86sthbHRjGH2m0yyE7zvNFYSg@mail.gmail.com>
Date: Mon, 26 Apr 2021 09:12:48 +0100
From: Lorenz Bauer <lmb@...udflare.com>
To: Andrii Nakryiko <andrii@...nel.org>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 4/5] selftests/bpf: fix field existence CO-RE
reloc tests
On Sat, 24 Apr 2021 at 00:36, Andrii Nakryiko <andrii@...nel.org> wrote:
>
> Negative field existence cases for have a broken assumption that FIELD_EXISTS
> CO-RE relo will fail for fields that match the name but have incompatible type
> signature. That's not how CO-RE relocations generally behave. Types and fields
> that match by name but not by expected type are treated as non-matching
> candidates and are skipped. Error later is reported if no matching candidate
> was found. That's what happens for most relocations, but existence relocations
> (FIELD_EXISTS and TYPE_EXISTS) are more permissive and they are designed to
> return 0 or 1, depending if a match is found. This allows to handle
> name-conflicting but incompatible types in BPF code easily. Combined with
> ___flavor suffixes, it's possible to handle pretty much any structural type
> changes in kernel within the compiled once BPF source code.
>
> So, long story short, negative field existence test cases are invalid in their
> assumptions, so this patch reworks them into a single consolidated positive
> case that doesn't match any of the fields.
>
> Fixes: c7566a69695c ("selftests/bpf: Add field existence CO-RE relocs tests")
> Reported-by: Lorenz Bauer <lmb@...udflare.com>
> Signed-off-by: Andrii Nakryiko <andrii@...nel.org>
Acked-by: Lorenz Bauer <lmb@...udflare.com>
--
Lorenz Bauer | Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK
www.cloudflare.com
Powered by blists - more mailing lists