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: <a83777e4-528f-8adb-33e4-a0fea8d544a0@huawei.com>
Date:   Fri, 17 Dec 2021 10:25:00 +0800
From:   Pu Lehui <pulehui@...wei.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
CC:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        john fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Shuah Khan <shuah@...nel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix building error when using
 userspace pt_regs



On 2021/12/16 12:06, Andrii Nakryiko wrote:
> On Tue, Dec 14, 2021 at 5:54 AM Pu Lehui <pulehui@...wei.com> wrote:
>>
>> When building bpf selftests on arm64, the following error will occur:
>>
>> progs/loop2.c:20:7: error: incomplete definition of type 'struct
>> user_pt_regs'
>>
>> Some archs, like arm64 and riscv, use userspace pt_regs in
>> bpf_tracing.h, which causes build failure when bpf prog use
>> macro in bpf_tracing.h. So let's use vmlinux.h directly.
> 
> We could probably also extend bpf_tracing.h to work with
> kernel-defined pt_regs, just like we do for x86 (see __KERNEL__ and
> __VMLINUX_H__ checks). It's more work, but will benefit other end
> users, not just selftests.
> 
It might change a lot. We can use header file directory generated by 
"make headers_install" to fix it.

--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -294,7 +294,8 @@ MENDIAN=$(if 
$(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
  CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
  BPF_CFLAGS = -g -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
  	     -I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
-	     -I$(abspath $(OUTPUT)/../usr/include)
+	     -I$(abspath $(OUTPUT)/../usr/include) \
+	     -I../../../../usr/include
>>
>> Signed-off-by: Pu Lehui <pulehui@...wei.com>
>> ---
>>   tools/testing/selftests/bpf/progs/loop1.c     |  8 ++------
>>   tools/testing/selftests/bpf/progs/loop2.c     |  8 ++------
>>   tools/testing/selftests/bpf/progs/loop3.c     |  8 ++------
>>   tools/testing/selftests/bpf/progs/loop6.c     | 20 ++++++-------------
>>   .../selftests/bpf/progs/test_overhead.c       |  8 ++------
>>   .../selftests/bpf/progs/test_probe_user.c     |  6 +-----
>>   6 files changed, 15 insertions(+), 43 deletions(-)
>>
> 
> [...]
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ