标签: kprobe

kprobe 是否可用于除 /sys/kernel/debug/kprobes/blacklist 中的函数之外的所有函数?

我正在使用 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 ?

感谢任何人的帮助!

linux trace kernel kprobe

5
推荐指数
0
解决办法
1918
查看次数

未定义的异常处理程序(__und_svc)在kprobes中的作用是什么?

我试图将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扩展

我想从这些疑虑中解脱出来.

  1. 如果处理kprobe未定义的指令异常(仅创建bcos kprobe),则__und_svc()调用原因.__und_svc()处理程序对kprobes 的作用是什么?

  2. 如果64字节内存是强制的,那么如何在不编译内核的情况下进行分配.即如何动态地做到这一点.

请分享您的知识.

arm linux-kernel systemtap armv7 kprobe

4
推荐指数
1
解决办法
849
查看次数

为什么 _do_fork() 的 kretprobe 只返回一次?

当我用 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_processwake_up_new_task)。后面的代码不应该在两个进程中都运行吗?
  • 系统调用后的内核代码是否与系统调用前的用户代码在同一线程/进程中运行?

c linux kernel systemtap kprobe

4
推荐指数
1
解决办法
368
查看次数

在kprobes支持ftrace之后,Linux内核中的跟踪点是否冗余?

在Linux内核中提供kprobe事件支持ftrace时使用跟踪点事件的用例有哪些?似乎可以使用"跟踪点事件"使用kprobe事件完成所有可能的事情,因为可以在跟踪点事件可用的同一点设置kprobe事件.

我错过了什么吗?

ftrace linux-kernel kprobe

4
推荐指数
1
解决办法
423
查看次数

ebpf:拦截函数调用

我正在阅读有关kprobesBPF程序类型的信息,我想知道是否有可能不仅为了跟踪目的而拦截函数调用或收集一些底层信息(寄存器,堆栈等),还可以替代调用并执行而不是实际执行功能?

是否kprobe提供此功能,或者我在寻找错误的工具?

system-calls linux-kernel kprobe bpf ebpf

2
推荐指数
1
解决办法
405
查看次数

sys/kernel/debug/krpobes/列表为空

我正在尝试附加到 kprobe 事件以用于工具,但我对 kprobe 事件不太熟悉。我读到注册的 kprobes 列表可用,/sys/kernel/debug/kprobes/listsudo less /sys/kernel/debug/krpobes/list显示没有注册的 kprobes。我已确认 krpobes/enabled 为 1。我是否做错了什么?

trace kernel kprobe

2
推荐指数
1
解决办法
1778
查看次数

我可以将 eBPF 程序附加到哪些 kprobe 挂钩?

我正在学习 eBPF,并且我知道我可以将我的 eBPF 程序附加到 kprobes、uprobes、tracepoint 等。我看到 /sys/kernel/debug/tracing/events/ 下有一个跟踪点列表,我可以将 eBPF 程序附加到其中。但是,如何找到可以侵入哪些 kprobe 函数(例如 TCP 相关函数)?另外,如何找到这些函数签名?

谢谢。

kprobe ebpf

2
推荐指数
1
解决办法
2663
查看次数

异常:执行 sudo opensnoop-bpfcc 时无法将 BPF 连接到 kprobe

当我尝试执行时,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)

kprobe ebpf bcc-bpf

0
推荐指数
1
解决办法
3709
查看次数

标签 统计

kprobe ×8

ebpf ×3

kernel ×3

linux-kernel ×3

linux ×2

systemtap ×2

trace ×2

arm ×1

armv7 ×1

bcc-bpf ×1

bpf ×1

c ×1

ftrace ×1

system-calls ×1