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:   Thu, 16 Dec 2021 11:30:01 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Shuah Khan <skhan@...uxfoundation.org>
Cc:     Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Shuah Khan <shuah@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] selftests/bpf: remove ARRAY_SIZE defines from tests

On Thu, Dec 16, 2021 at 6:42 AM Shuah Khan <skhan@...uxfoundation.org> wrote:
>
> On 12/15/21 9:04 PM, Andrii Nakryiko wrote:
> > On Tue, Dec 14, 2021 at 12:27 PM Shuah Khan <skhan@...uxfoundation.org> wrote:
> >>
> >> On 12/11/21 6:53 PM, Alexei Starovoitov wrote:
> >>> On Fri, Dec 10, 2021 at 9:34 AM Shuah Khan <skhan@...uxfoundation.org> wrote:
> >>>>
> >>>> ARRAY_SIZE is defined in multiple test files. Remove the definitions
> >>>> and include header file for the define instead.
> >>>>
> >>>> Remove ARRAY_SIZE define and add include bpf_util.h to bring in the
> >>>> define.
> >>>>
> >>>> Signed-off-by: Shuah Khan <skhan@...uxfoundation.org>
> >>>> ---
> >>>>    tools/testing/selftests/bpf/progs/netif_receive_skb.c | 5 +----
> >>>>    tools/testing/selftests/bpf/progs/profiler.inc.h      | 5 +----
> >>>>    tools/testing/selftests/bpf/progs/test_sysctl_loop1.c | 5 +----
> >>>>    tools/testing/selftests/bpf/progs/test_sysctl_loop2.c | 4 +---
> >>>>    tools/testing/selftests/bpf/progs/test_sysctl_prog.c  | 5 +----
> >>>>    5 files changed, 5 insertions(+), 19 deletions(-)
> >>>>
> >>>> diff --git a/tools/testing/selftests/bpf/progs/netif_receive_skb.c b/tools/testing/selftests/bpf/progs/netif_receive_skb.c
> >>>> index 1d8918dfbd3f..7a5ebd330689 100644
> >>>> --- a/tools/testing/selftests/bpf/progs/netif_receive_skb.c
> >>>> +++ b/tools/testing/selftests/bpf/progs/netif_receive_skb.c
> >>>> @@ -5,6 +5,7 @@
> >>>>    #include <bpf/bpf_helpers.h>
> >>>>    #include <bpf/bpf_tracing.h>
> >>>>    #include <bpf/bpf_core_read.h>
> >>>> +#include <bpf/bpf_util.h>
> >>>
> >>> It doesn't look like you've built it.
> >>>
> >>> progs/test_sysctl_prog.c:11:10: fatal error: 'bpf/bpf_util.h' file not found
> >>> #include <bpf/bpf_util.h>
> >>>            ^~~~~~~~~~~~~~~~
> >>>     CLNG-BPF [test_maps] socket_cookie_prog.o
> >>> progs/test_sysctl_loop2.c:11:10: fatal error: 'bpf/bpf_util.h' file not found
> >>> #include <bpf/bpf_util.h>
> >>>            ^~~~~~~~~~~~~~~~
> >>> 1 error generated.
> >>> In file included from progs/profiler2.c:6:
> >>> progs/profiler.inc.h:7:10: fatal error: 'bpf/bpf_util.h' file not found
> >>> #include <bpf/bpf_util.h>
> >>>            ^~~~~~~~~~~~~~~~
> >>>
> >>
> >> Sorry about that. I built it - I think something is wrong in my env. Build
> >> fails complaining about not finding vmlinux - I overlooked that the failure
> >> happened before it got to progs.
> >>
> >> Error: failed to load BTF from .../vmlinux: No such file or directory
> >
> > Please make sure that you build vmlinux before you build selftests,
> > BPF selftests use vmlinux to generate vmlinux.h with all kernel types
> > (among other things). So please also make sure that all the setting in
> > selftests/bpf/config were used in your Kconfig.
> >
> >>
>
> The problem in my env. is that I don't have CONFIG_DEBUG_INFO_BTF in
> my config and then don't have the dwarves and llvm-strip on my system.
> Pains of upgrading.
>
> I am all set now. On the other hand the vmlinux.h is a mess. It has
> no guards for defines and including stdio.h and this generated
> vmlinux.h causes all sorts of problems.

It does have

#ifndef __VMLINUX_H__
#define __VMLINUX_H__

Are we talking about the same vmlinux.h here?

As for stdio.h. vmlinux.h doesn't co-exist with other headers well,
it's a known inconvenience we are trying to fix at Clang side. But
stdio.h makes no sense as vmlinux.h is supposed to be used only from
the BPF program side, where stdio.h never worked. So not sure what you
are trying to do, but vmlinux.h works fine for cases it was created
for.

>
> thanks,
> -- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ