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