-
Notifications
You must be signed in to change notification settings - Fork 5
/
syscallTable.c
50 lines (44 loc) · 1.09 KB
/
syscallTable.c
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
40
41
42
43
44
45
46
47
48
49
50
/*
* The KErnel ROotKIt Detector (KEROKID)
*
* (c) 2014 Fraunhofer FKIE
*/
#include "syscallTable.h"
#include "kerokid.h"
#include "addressAnalysis.h"
#include "proc_file.h"
/* -------- global variables -------------- */
psize **syscallTable;
/* ------------- setup functions ---------------------- */
void init_systemcall_table(void)
{
psize **sctable;
psize i = SPACE_WITH_SCT_START;
while (i < SPACE_WITH_SCT_END) {
sctable = (psize **) i;
if (sctable[__NR_close] == (psize *)sys_close) {
syscallTable = &sctable[0];
break;
}
i += sizeof(void *);
}
if (syscallTable == NULL)
printk(KERN_ALERT"KEROKID: ERROR: Could not detect SystemCall table!\n");
}
/* ---------------------------------------------------------------- */
psize **get_systemcall_table(void)
{
return syscallTable;
}
void check_syscall_table(void)
{
int i;
cat_proc_message("syscall table:\n");
for (i=0; i < NUMBER_OF_SYSCALLS; i++) {
if (analyze_address(syscallTable[i], formats(" from syscall %d", i)))
finds.syscalls++;
}
if (!finds.syscalls)
cat_proc_message("nothing found\n");
return;
}