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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 11 Nov 2022 20:09:34 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v1 0/7] Fix perf trace libbpf 1.0+ compatibility

Hi Ian, Arnaldo,

On Wed, Nov 02, 2022 at 09:54:30PM -0700, Ian Rogers wrote:
> Perf trace can augment system calls with a BPF program passed as an
> event. The BPF code for this lives in examples. This patch fixes the
> example code to not used deprecated/removed APIs in libbpf. As libbpf
> has similar header files to tools/perf/include/bpf the code is
> transitioned to use the more standard libbpf code and the perf BPF
> header files removed.

I think you missed to update the code examples/bpf/sys_enter_openat.c,
either you could remove it (since it's duplicate with
augmented_raw_syscalls.c), or we should apply below fixing:

>From f30af3b43060e482c54e113cbe90223173c69abd Mon Sep 17 00:00:00 2001
From: Leo Yan <leo.yan@...aro.org>
Date: Fri, 11 Nov 2022 12:02:24 +0000
Subject: [PATCH] perf trace: sys_enter_openat.c fix libbpf 1.0+ compatibility

Avoid use of tools/perf/include/bpf/bpf.h and use the more regular BPF
headers.

With fixing:

  # ./perf trace -e examples/bpf/sys_enter_openat.c
  0.000 irqbalance/1025 syscalls:sys_enter_openat(AT_FDCWD, "", O_RDONLY)
  1.596 irqbalance/1025 syscalls:sys_enter_openat(AT_FDCWD, "", O_RDONLY)
  1.832 irqbalance/1025 syscalls:sys_enter_openat(AT_FDCWD, "", O_RDONLY)
  1.864 irqbalance/1025 syscalls:sys_enter_openat(AT_FDCWD, "", O_RDONLY)

Signed-off-by: Leo Yan <leo.yan@...aro.org>
---
 tools/perf/examples/bpf/sys_enter_openat.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/examples/bpf/sys_enter_openat.c b/tools/perf/examples/bpf/sys_enter_openat.c
index c4481c390d23..8edfa7c147d1 100644
--- a/tools/perf/examples/bpf/sys_enter_openat.c
+++ b/tools/perf/examples/bpf/sys_enter_openat.c
@@ -14,7 +14,9 @@
  * the return value.
  */
 
-#include <bpf/bpf.h>
+#include <linux/bpf.h>
+#include <linux/limits.h>
+#include <bpf/bpf_helpers.h>
 
 struct syscall_enter_openat_args {
 	unsigned long long unused;
@@ -25,9 +27,10 @@ struct syscall_enter_openat_args {
 	long		   mode;
 };
 
-int syscall_enter(openat)(struct syscall_enter_openat_args *args)
+SEC("syscalls:sys_enter_openat")
+int syscall_enter_openat(struct syscall_enter_openat_args *args)
 {
 	return 1;
 }
 
-license(GPL);
+char _license[] SEC("license") = "GPL";

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ