Код: Выделить всё
// Kernel version : 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 11 15:25:05 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
ffffffff99e64820 t kprobe_seq_start
ffffffff99e64850 t kprobe_seq_next
ffffffff99e64890 t kprobe_seq_stop
Код: Выделить всё
// 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
[user@localhost ~]$ sudo cat /proc/kallsyms | grep kprobe_seq
ffffffffab7bfe70 t kprobe_seq_start
ffffffffab7bfe90 t kprobe_seq_next
ffffffffab7bfec0 t kprobe_seq_stop
Код: Выделить всё
#include [*]
#include
#include
#include
#include
static struct kretprobe kretseqnext =
{
.handler = kprobe_seq_ret_handler,
.kp.symbol_name = "...",
};
static int kprobe_seq_ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs)
{
set_return_value(regs, 0);
return 0;
}
static int __init kprobe_init(void)
{
int ret;
ret = register_kretprobe(&kretseqnext);
if (ret < 0) {
printk("Failed registering kretprobe kprobe_seq_next %d\n", ret);
return ret;
}
printk("Registering kprobe_seq_next\n");
return 0;
}
static void __exit kprobe_exit(void)
{
unregister_kretprobe(&kretseqnext);
printk("Unregistering kretprobe kprobe_seq_next\n");
}
Код: Выделить всё
obj-m += gap.o
KBUILD_CFLAGS += -Wno-unused-function
CCFLAG-y := -g -O3 -flto -march=native -mtune=native -fomit-frame-pointer -funroll-loops -finline-functions
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
- Почему я не могу установить kprobe/kretprobe для этой функции?
Подробнее здесь: https://stackoverflow.com/questions/790 ... -functions
Мобильная версия