[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFnufp31Sw8z6f6z1ZR5W9Z61qBMWsOFdN3bFbWNU6vT4KKOvw@mail.gmail.com>
Date: Sun, 6 Feb 2022 23:27:43 +0100
From: Matteo Croce <mcroce@...ux.microsoft.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next v3 2/2] selftests/bpf: test maximum recursion
depth for bpf_core_types_are_compat()
On Fri, Feb 4, 2022 at 8:38 PM Alexei Starovoitov
<alexei.starovoitov@...il.com> wrote:
>
> On Thu, Feb 3, 2022 at 4:55 PM Matteo Croce <mcroce@...ux.microsoft.com> wrote:
> > --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> > +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> > @@ -13,6 +13,11 @@
> > #define CREATE_TRACE_POINTS
> > #include "bpf_testmod-events.h"
> >
> > +typedef int (*func_proto_typedef___match)(long);
> > +typedef int (*func_proto_typedef___overflow)(func_proto_typedef___match);
>
> There is no need for "___flavor" on the kernel side of type definition.
> It makes the test confusing to read.
>
> > +func_proto_typedef___match funcp = NULL;
> > +func_proto_typedef___overflow funcp_of = NULL;
>
> We have BTF_TYPE_EMIT() macro to avoid unnecessary declaration.
>
> > +typedef int (*func_proto_typedef___match)(long);
> > +typedef int (*func_proto_typedef___overflow)(func_proto_typedef___match);
>
> With <=1 in the previous patch such single depth of func_proto
> was reaching the recursion limit.
> Hence the fix <=0 was necessary.
> I've also changed this test to:
>
> +typedef int (*func_proto_typedef)(long);
> +typedef int (*func_proto_typedef_nested1)(func_proto_typedef);
> +typedef int (*func_proto_typedef_nested2)(func_proto_typedef_nested1);
>
> in bpf_testmod.c and in progs/core_kern_overflow.c
> and
> bpf_core_type_exists(func_proto_typedef_nested2);
> to go above the limit.
>
> Also added bpf_core_type_exists(func_proto_typedef_nested1)
> to progs/core_kern.c to stay at the limit.
>
> Please see the result in bpf-next.
Awesome.
I've seen both patches in the repo, LGTM.
--
per aspera ad upstream
Powered by blists - more mailing lists