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: <c2f564a3-f942-d275-3ecb-b679aa0810ec@linux.dev>
Date:   Sun, 20 Aug 2023 21:34:37 -0700
From:   Yonghong Song <yonghong.song@...ux.dev>
To:     Rong Tao <rtoax@...mail.com>
Cc:     andrii@...nel.org, ast@...nel.org, bpf@...r.kernel.org,
        daniel@...earbox.net, haoluo@...gle.com, john.fastabend@...il.com,
        kpsingh@...nel.org, linux-kernel@...r.kernel.org,
        linux-kselftest@...r.kernel.org, martin.lau@...ux.dev,
        mykolal@...com, olsajiri@...il.com, rongtao@...tc.cn,
        sdf@...gle.com, shuah@...nel.org, song@...nel.org
Subject: Re: [PATCH bpf-next v5] selftests/bpf: trace_helpers.c: optimize
 kallsyms cache



On 8/20/23 7:03 PM, Rong Tao wrote:
> Sorry Song, I did not state clear.
> 
> libbpf_ensure_mem() is declared in libbpf_internal.h, we want to use
> libbpf_ensure_mem() in trace_helpers.c, Unforturnately, we could only include
> the headers 'install_headers:' defined in tools/lib/bpf/Makefile, the
> 'install_headers:' target does not include libbpf_internal.h, like:
> 
> 	tools/testing/selftests/bpf/trace_helpers.c:17:10:
> 	fatal error: libbpf_internal.h: No such file or directory
> 	   17 | #include "libbpf_internal.h"
> 	      |          ^~~~~~~~~~~~~~~~~~~
> 
> 	tools/testing/selftests/bpf/trace_helpers.c:17:10:
> 	fatal error: bpf/libbpf_internal.h: No such file or directory
> 	   17 | #include "bpf/libbpf_internal.h"
> 	      |           ^~~~~~~~~~~~~~~~~~~~~~~


It works fine for me. On top of your patch, the following works fine:

diff --git a/tools/testing/selftests/bpf/trace_helpers.c 
b/tools/testing/selftests/bpf/trace_helpers.c
index 0053ba22f0cb..087383c5dc3a 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -14,6 +14,7 @@
  #include <linux/limits.h>
  #include <libelf.h>
  #include <gelf.h>
+#include "bpf/libbpf_internal.h"

  #define TRACEFS_PIPE   "/sys/kernel/tracing/trace_pipe"
  #define DEBUGFS_PIPE   "/sys/kernel/debug/tracing/trace_pipe"

With V=1 when building selftests, the following is the compilation
command line:
clang --target=x86_64-linux-gnu -fintegrated-as -g -O0 -rdynamic -Wall 
-Werror   -I/home/yhs/work/bpf-next/tools/testing/selftests/bpf 
-I/home/yhs/work/bpf-next/tools/testing/selftests/bpf/tools/include 
-I/home/yhs/work/bpf-next/include/generated 
-I/home/yhs/work/bpf-next/tools/lib 
-I/home/yhs/work/bpf-next/tools/include 
-I/home/yhs/work/bpf-next/tools/include/uapi 
-I/home/yhs/work/bpf-next/tools/testing/selftests/bpf 
-Wno-unused-command-line-argument  -c trace_helpers.c -lelf -lz -lrt 
-lpthread -o 
/home/yhs/work/bpf-next/tools/testing/selftests/bpf/trace_helpers.o

This include path
   /home/yhs/work/bpf-next/tools/testing/selftests/bpf/tools/include
will make including 'bpf/libbpf_internal.h' work.

> 
> How about
> 
> 1. dup-declare libbpf_ensure_mem() in trace_helpers.c
> 2. move libbpf_ensure_mem() declare into libbpf_common.h
> 
> Which one do you like best.
> 
> Best wishes,
> Rong Tao
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ