Loading...
Note: File does not exist in v3.1.
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>
4
5#include <linux/kernel.h>
6#include <linux/module.h>
7#include <linux/kprobes.h>
8
9static bool has_post_handler = true;
10module_param(has_post_handler, bool, 0444);
11
12static void __kprobes post_handler(struct kprobe *p, struct pt_regs *regs,
13 unsigned long flags)
14{
15}
16
17static struct kprobe kp = {
18 .symbol_name = "cmdline_proc_show",
19};
20
21static int __init kprobe_init(void)
22{
23 if (has_post_handler)
24 kp.post_handler = post_handler;
25
26 return register_kprobe(&kp);
27}
28
29static void __exit kprobe_exit(void)
30{
31 unregister_kprobe(&kp);
32}
33
34module_init(kprobe_init)
35module_exit(kprobe_exit)
36MODULE_LICENSE("GPL");
37MODULE_AUTHOR("Michael Vetter <mvetter@suse.com>");
38MODULE_DESCRIPTION("Livepatch test: kprobe function");