Replies: 3 comments 3 replies
-
I try to force arm64,got failed too. add_defines("__TARGET_ARCH_arm64")
|
Beta Was this translation helpful? Give feedback.
-
Are you sure you are including either vmlinux.h or linux/ptrace.h in your BPF code where you are including bpf/bpf_tracing.h? bpf_tracing.h assumes that struct pt_regs/struct user_pt_regs is included by the user code |
Beta Was this translation helpful? Give feedback.
-
Two ways to fix the issue: diff --git a/examples/c/uprobe.bpf.c b/examples/c/uprobe.bpf.c
index c5c9ba0..e508314 100644
--- a/examples/c/uprobe.bpf.c
+++ b/examples/c/uprobe.bpf.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/* Copyright (c) 2020 Facebook */
-#include <linux/bpf.h>
-#include <linux/ptrace.h>
+#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h> Or: ln -s /usr/include/aarch64-linux-gnu/asm /usr/include/asm |
Beta Was this translation helpful? Give feedback.
-
I build for android platform ,failed ,log bellow
kprobe.bpf.c:11:5: error: no member named 'uregs' in 'struct pt_regs'
int BPF_KPROBE(do_unlinkat, int dfd, struct filename *name)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/bpf/bpf_tracing.h:815:20: note: expanded from macro 'BPF_KPROBE'
return ____##name(___bpf_kprobe_args(args));
^~~~~~~~~~~~~~~~~~~~~~~~
build/bpf/bpf_tracing.h:795:41: note: expanded from macro '___bpf_kprobe_args'
#define ___bpf_kprobe_args(args...) ___bpf_apply(___bpf_kprobe_args, ___bpf_narg(args))(args)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/bpf/bpf_helpers.h:184:29: note: expanded from macro '___bpf_apply'
#define ___bpf_apply(fn, n) ___bpf_concat(fn, n)
^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
build/bpf/bpf_tracing.h:787:72: note: expanded from macro '___bpf_kprobe_args1'
#define ___bpf_kprobe_args1(x) ___bpf_kprobe_args0(), (void *)PT_REGS_PARM1(ctx)
^~~~~~~~~~~~~~~~~~
build/bpf/bpf_tracing.h:483:46: note: expanded from macro 'PT_REGS_PARM1'
#define PT_REGS_PARM1(x) (__PT_REGS_CAST(x)->__PT_PARM1_REG)
Beta Was this translation helpful? Give feedback.
All reactions