1 #include <linux/module.h>
2 #include <linux/kernel.h>
3 #include <linux/init.h>
4 #include <linux/kprobes.h>
8 static int kph(struct kprobe
*kp
, struct pt_regs
*regs
)
12 static int kpfh(struct kprobe
*kp
, struct pt_regs
*regs
, int nr
)
14 printk("fault occurred on kprobes at %p(@%lx:%d)\n", kp
->addr
, regs
->ip
, nr
);
17 static struct kprobe kp
[] = {
18 [0]={.pre_handler
=kph
, .fault_handler
=kpfh
, .symbol_name
="sys_accept"},
19 [1]={.pre_handler
=kph
, .fault_handler
=kpfh
, .symbol_name
="sys_access"},
20 [2]={.pre_handler
=kph
, .fault_handler
=kpfh
, .symbol_name
="sys_acct"},
21 [3]={.pre_handler
=kph
, .fault_handler
=kpfh
, .symbol_name
="sys_add_key"},
22 [4]={.pre_handler
=kph
, .fault_handler
=kpfh
, .symbol_name
="sys_adjtimex"},
23 [5]={.pre_handler
=kph
, .fault_handler
=kpfh
, .symbol_name
="sys_alarm"},
24 [6]={.pre_handler
=kph
, .fault_handler
=kpfh
, .symbol_name
="sys_bdflush"},
28 static struct kprobe
*kps
[NRPB
];
35 printk("registering...");
36 ret
= register_kprobes(kps
, NRPB
);
38 printk("failed to register kprobes\n");
41 printk("registered\n");
47 printk("unregistering...");
48 unregister_kprobes(kps
, NRPB
);
49 printk("unregistered\n");
52 module_init(__gen_init
);
53 module_exit(__gen_exit
);
This page took 0.030147 seconds and 4 git commands to generate.