我正在使用 kprobe 命令来跟踪一些内核函数。我使用的命令是:
kprobe“p:balance_pgdat”
但出现以下错误:
错误:funcbalance_pgdat 不在
/sys/kernel/debug/tracing/available_filter_functions.
Either it doesn't exist, or, it might be unsafe to kprobe. Existing. Use -F to override.
Run Code Online (Sandbox Code Playgroud)
我已经检查过balance_pgdat不在available_filter_functions中。但是,根据我的理解,无法追踪的功能保存在 /sys/kernel/debug/kprobes/blacklist 中,为什么还有其他功能不适用于 kprobe ?
感谢任何人的帮助!
我试图将kprobe转换为可加载的内核模块.
我能够samples/kprobes/
从内核树中运行文件夹中的可用示例.
如果我们在kernel(CONFIG_KPROBES
)中配置kprobes ,那么svc_entry
宏将在__und_svc()
处理程序中扩展为64字节.
参考: http ://lxr.free-electrons.com/source/arch/arm/kernel/entry-armv.S?a = arm#L245
我的目标是没有触及内核端,使kprobe成为内核模块.
因此编译内核时不启用CONFIG_KPROBES.所以svc_entry宏将在__und_svc()中以0扩展
我想从这些疑虑中解脱出来.
如果处理kprobe未定义的指令异常(仅创建bcos kprobe),则__und_svc()
调用原因.__und_svc()
处理程序对kprobes 的作用是什么?
如果64字节内存是强制的,那么如何在不编译内核的情况下进行分配.即如何动态地做到这一点.
请分享您的知识.
当我用 fork 编写一个小脚本时,系统调用返回两次进程(每个进程一次):
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int pid = fork();
if (pid == 0) {
// child
} else if (pid > 0) {
// parent
}
}
Run Code Online (Sandbox Code Playgroud)
如果我使用 systemtap 进行检测,我只会找到一个返回值:
// fork() in libc calls clone on Linux
probe syscall.clone.return {
printf("Return from clone\n")
}
Run Code Online (Sandbox Code Playgroud)
(SystemTap 安装探针_do_fork
而不是克隆,但这不应该改变任何东西。)
这让我很困惑。几个相关的问题:
_do_fork
代码,则该过程将在函数中间被克隆。(copy_process
和wake_up_new_task
)。后面的代码不应该在两个进程中都运行吗?在Linux内核中提供kprobe事件支持ftrace时使用跟踪点事件的用例有哪些?似乎可以使用"跟踪点事件"使用kprobe事件完成所有可能的事情,因为可以在跟踪点事件可用的同一点设置kprobe事件.
我错过了什么吗?
我正在阅读有关kprobes
BPF程序类型的信息,我想知道是否有可能不仅为了跟踪目的而拦截函数调用或收集一些底层信息(寄存器,堆栈等),还可以替代调用并执行而不是实际执行功能?
是否kprobe
提供此功能,或者我在寻找错误的工具?
我正在尝试附加到 kprobe 事件以用于工具,但我对 kprobe 事件不太熟悉。我读到注册的 kprobes 列表可用,/sys/kernel/debug/kprobes/list
但sudo less /sys/kernel/debug/krpobes/list
显示没有注册的 kprobes。我已确认 krpobes/enabled 为 1。我是否做错了什么?
我正在学习 eBPF,并且我知道我可以将我的 eBPF 程序附加到 kprobes、uprobes、tracepoint 等。我看到 /sys/kernel/debug/tracing/events/ 下有一个跟踪点列表,我可以将 eBPF 程序附加到其中。但是,如何找到可以侵入哪些 kprobe 函数(例如 TCP 相关函数)?另外,如何找到这些函数签名?
谢谢。
当我尝试执行时,sudo opensnoop-bpfcc
我收到此消息:
In file included from /virtual/main.c:4:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:40:
In file included from include/linux/preempt.h:81:
In file included from ./arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:38:
In file included from ./arch/x86/include/asm/thread_info.h:53:
./arch/x86/include/asm/cpufeature.h:150:2: warning: "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compiler arguments"
[-W#warnings]
#warning "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compiler arguments"
^
1 warning generated.
Traceback …
Run Code Online (Sandbox Code Playgroud)