-
Notifications
You must be signed in to change notification settings - Fork 21
/
sys_socketcalls_64.S
59 lines (54 loc) · 990 Bytes
/
sys_socketcalls_64.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
/*For 64bits asm*/
.section .text
.align 2
.globl connp_sys_poll
.type connp_sys_poll, @function
connp_sys_poll:
push %r12
mov %rdx,%r12
push %rbp
mov %rdi,%rbp
push %rbx
mov %esi,%ebx
sub $0x8,%rsp
cmp $0x1,%esi
je connp_poll
orig_sys_call:
mov %r12,%rdx
mov %ebx,%esi
mov %rbp,%rdi
add $0x8,%rsp
pop %rbx
pop %rbp
pop %r12
jmp *orig_sys_poll
out_ret:
add $0x8,%rsp
pop %rbx
pop %rbp
pop %r12
retq
connp_poll:
mov %rdi,%rsi
mov $0x8,%edx
mov %rsp,%rdi
callq lkm_copy_from_user
test %rax,%rax
jne orig_sys_call
testb $0x1,0x4(%rsp)
je orig_sys_call
mov (%rsp),%edi
xor %edx,%edx
xor %esi,%esi
mov $0x69,%ecx
callq check_if_ignore_auth_procedure
test %eax,%eax
je orig_sys_call
orw $0x1,0x6(%rsp)
xor %eax,%eax
mov (%rsp),%rdx
mov %rdx,0x0(%rbp)
test %eax,%eax
jne orig_sys_call
mov $0x1,%eax
jmp out_ret