1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2024 Marcos Paulo de Souza <mpdesouza@suse.com>
3 // Copyright (C) 2024 Michael Vetter <mvetter@suse.com>
5 #include <linux/kernel.h>
6 #include <linux/module.h>
7 #include <linux/kprobes.h>
9 static bool has_post_handler
= true;
10 module_param(has_post_handler
, bool, 0444);
12 static void __kprobes
post_handler(struct kprobe
*p
, struct pt_regs
*regs
,
17 static struct kprobe kp
= {
18 .symbol_name
= "cmdline_proc_show",
21 static int __init
kprobe_init(void)
24 kp
.post_handler
= post_handler
;
26 return register_kprobe(&kp
);
29 static void __exit
kprobe_exit(void)
31 unregister_kprobe(&kp
);
34 module_init(kprobe_init
)
35 module_exit(kprobe_exit
)
36 MODULE_LICENSE("GPL");
37 MODULE_AUTHOR("Michael Vetter <mvetter@suse.com>");
38 MODULE_DESCRIPTION("Livepatch test: kprobe function");