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]
Message-ID: <CAADnVQ+tesyKMd864TzBgfynuxosPPoGgHiB0M9p2oRjitdv2g@mail.gmail.com>
Date:   Fri, 4 Feb 2022 11:37:48 -0800
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Matteo Croce <mcroce@...ux.microsoft.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 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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ