blob: 9643984d24022b24b02436a7c68ecc582fb1ac6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2026 Pablo Hugen <phugen@redhat.com>
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
static struct proc_dir_entry *pde;
static noinline int test_klp_mod_target_show(struct seq_file *m, void *v)
{
seq_printf(m, "%s: %s\n", THIS_MODULE->name, "original output");
return 0;
}
static int test_klp_mod_target_init(void)
{
pr_info("%s\n", __func__);
pde = proc_create_single("test_klp_mod_target", 0, NULL,
test_klp_mod_target_show);
if (!pde)
return -ENOMEM;
return 0;
}
static void test_klp_mod_target_exit(void)
{
pr_info("%s\n", __func__);
proc_remove(pde);
}
module_init(test_klp_mod_target_init);
module_exit(test_klp_mod_target_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pablo Hugen <phugen@redhat.com>");
MODULE_DESCRIPTION("Livepatch test: target module with proc entry");
|