-
Notifications
You must be signed in to change notification settings - Fork 21
/
sys_socketcalls_32.S
69 lines (65 loc) · 1.18 KB
/
sys_socketcalls_32.S
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*for 32bits asm*/
.section .text
.align 2
.globl connp_sys_poll
.type connp_sys_poll, @function
.type connp_sys_poll, @function
connp_sys_poll:
push %ebp
mov %esp,%ebp
push %edi
push %esi
push %ebx
sub $0x8,%esp
mov 0xc(%ebp),%edi
mov 0x8(%ebp),%esi
cmp $0x1,%edi
jne orig_sys_call
lea -0x14(%ebp),%eax
mov $0x8,%ecx
mov %esi,%edx
call lkm_copy_from_user
test %eax,%eax
mov %eax,%ebx
jne orig_sys_call
testb $0x1,-0x10(%ebp)
je orig_sys_call
mov -0x14(%ebp),%eax
xor %edx,%edx
xor %ecx,%ecx
push $0x69
call check_if_ignore_auth_procedure
pop %edx
test %eax,%eax
je orig_sys_call
orw $0x1,-0xe(%ebp)
mov -0x14(%ebp),%eax
mov -0x10(%ebp),%edx
mov %eax,(%esi)
mov %edx,0x4(%esi)
test %ebx,%ebx
mov $0x1,%eax
je out_ret
orig_sys_call:
lea -0xc(%ebp),%esp
pop %ebx
pop %esi
pop %edi
pop %ebp
/*change call to jmp to fix bug when the kconnp is unloaded*/
/*
pushl 0x10(%ebp)
push %edi
push %esi
*/
jmp *orig_sys_poll
/*
add $0xc,%esp
*/
out_ret:
lea -0xc(%ebp),%esp
pop %ebx
pop %esi
pop %edi
pop %ebp
ret