1 |
kumaneko |
442 |
/* |
2 |
kumaneko |
557 |
* test.c |
3 |
kumaneko |
442 |
* |
4 |
|
|
* Copyright (C) 2010-2013 Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
5 |
|
|
*/ |
6 |
|
|
#include "probe.h" |
7 |
|
|
|
8 |
|
|
/** |
9 |
|
|
* ccs_init - Initialize this module. |
10 |
|
|
* |
11 |
|
|
* Returns 0 on success, -EINVAL otherwise. |
12 |
|
|
*/ |
13 |
|
|
static int __init ccs_init(void) |
14 |
|
|
{ |
15 |
kumaneko |
632 |
void *ptr; |
16 |
|
|
|
17 |
kumaneko |
496 |
#if defined(LSM_HOOK_INIT) |
18 |
kumaneko |
632 |
ptr = probe_security_hook_heads(); |
19 |
|
|
if (!ptr) |
20 |
kumaneko |
442 |
goto out; |
21 |
kumaneko |
632 |
printk(KERN_INFO "security_hook_heads=%lx\n", (unsigned long) ptr); |
22 |
kumaneko |
442 |
#else |
23 |
kumaneko |
632 |
ptr = probe_security_ops(); |
24 |
|
|
if (!ptr) |
25 |
kumaneko |
442 |
goto out; |
26 |
kumaneko |
632 |
printk(KERN_INFO "security_ops=%lx\n", (unsigned long) ptr); |
27 |
kumaneko |
442 |
#endif |
28 |
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) |
29 |
kumaneko |
632 |
ptr = probe_find_task_by_vpid(); |
30 |
|
|
if (!ptr) |
31 |
kumaneko |
442 |
goto out; |
32 |
kumaneko |
632 |
printk(KERN_INFO "find_task_by_vpid=%lx\n", (unsigned long) ptr); |
33 |
|
|
ptr = probe_find_task_by_pid_ns(); |
34 |
|
|
if (!ptr) |
35 |
kumaneko |
442 |
goto out; |
36 |
kumaneko |
632 |
printk(KERN_INFO "find_task_by_pid_ns=%lx\n", (unsigned long) ptr); |
37 |
kumaneko |
442 |
#endif |
38 |
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) |
39 |
kumaneko |
632 |
ptr = probe_vfsmount_lock(); |
40 |
|
|
if (!ptr) |
41 |
kumaneko |
442 |
goto out; |
42 |
kumaneko |
632 |
printk(KERN_INFO "vfsmount_lock=%lx\n", (unsigned long) ptr); |
43 |
kumaneko |
442 |
#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) |
44 |
kumaneko |
632 |
ptr = probe___d_path(); |
45 |
|
|
if (!ptr) |
46 |
kumaneko |
442 |
goto out; |
47 |
kumaneko |
632 |
printk(KERN_INFO "__d_path=%lx\n", (unsigned long) ptr); |
48 |
kumaneko |
442 |
#else |
49 |
kumaneko |
632 |
ptr = probe_d_absolute_path(); |
50 |
|
|
if (!ptr) |
51 |
kumaneko |
442 |
goto out; |
52 |
kumaneko |
632 |
printk(KERN_INFO "d_absolute_path=%lx\n", (unsigned long) ptr); |
53 |
kumaneko |
442 |
#endif |
54 |
kumaneko |
688 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) |
55 |
|
|
ptr = probe_copy_to_kernel_nofault(); |
56 |
|
|
if (!ptr) |
57 |
|
|
goto out; |
58 |
|
|
printk(KERN_INFO "copy_to_kernel_nofault=%lx\n", (unsigned long) ptr); |
59 |
|
|
#endif |
60 |
kumaneko |
442 |
printk(KERN_INFO "All dependent symbols have been guessed.\n"); |
61 |
kumaneko |
557 |
printk(KERN_INFO "Please verify these addresses using System.map for this kernel (e.g. /boot/System.map-`uname -r` ).\n"); |
62 |
|
|
printk(KERN_INFO "If these addresses are correct, you can try loading AKARI module on this kernel.\n"); |
63 |
kumaneko |
442 |
return 0; |
64 |
|
|
out: |
65 |
|
|
printk(KERN_INFO "Sorry, I couldn't guess dependent symbols.\n"); |
66 |
kumaneko |
557 |
printk(KERN_INFO "I need some changes for supporting your environment.\n"); |
67 |
kumaneko |
442 |
printk(KERN_INFO "Please contact the author.\n"); |
68 |
|
|
return -EINVAL; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
/** |
72 |
|
|
* ccs_exit - Exit this module. |
73 |
|
|
* |
74 |
|
|
* Returns nothing. |
75 |
|
|
*/ |
76 |
|
|
static void ccs_exit(void) |
77 |
|
|
{ |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
module_init(ccs_init); |
81 |
|
|
module_exit(ccs_exit); |
82 |
|
|
MODULE_LICENSE("GPL"); |