-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsyscall.h
97 lines (88 loc) · 3.62 KB
/
syscall.h
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* CreateRemoteThread for Linux
*
* Copyright (c) 2018, ilammy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*/
#ifndef LINUX_CRT_SYSCALL_H
#define LINUX_CRT_SYSCALL_H
#include <sys/mman.h>
#include <sys/types.h>
struct library;
/**
* find_syscall_instruction() - locate a SYSCALL instruction in the library
* @library: the library mapping to scan
*/
unsigned long find_syscall_instruction(struct library *library);
/**
* remote_mmap() - perform an mmap() system call in remote process
* @pid: PID of the target process
* @syscall_insn_vaddr: virtual address of SYSCALL instruction
* @addr: mmap argument: requested virtual address
* @length: mmap argument: requested mapping length
* @prot: mmap argument: requested memory protection
* @flags: mmap argument: mapping flags
* @fd: mmap argument: the backing file
* @offset: mmap argument: offset in the file
*
* This function preserves the register state of the process.
*
* Returns: corresponding virtual address on success, or zero on error.
*/
unsigned long remote_mmap(pid_t pid, unsigned long syscall_insn_vaddr,
unsigned long addr, size_t length, int prot, int flags,
int fd, off_t offset);
/**
* remote_mprotect() - perform an mprotect() system call in remote process
* @pid: PID of the target process
* @syscall_insn_vaddr: virtual address of SYSCALL instruction
* @addr: mprotect argument: address of the map to update
* @len: mprotect argument: length of the map to update
* @prot: mprotect argument: desired new protection
*
* This function preserves the register state of the process.
*
* Returns: corresponding virtual address on success, or zero on error.
*/
int remote_mprotect(pid_t pid, unsigned long syscall_insn_vaddr,
unsigned long addr, size_t len, int prot);
/**
* remote_munmap() - perform an munmap() system call in remote process
* @pid: PID of the target process
* @syscall_insn_vaddr: virtual address of SYSCALL instruction
* @addr: munmap argument: address of the map to remove
* @len: munmap argument: length of the map to remove
*
* This function preserves the register state of the process.
*
* Returns: corresponding virtual address on success, or zero on error.
*/
int remote_munmap(pid_t pid, unsigned long syscall_insn_vaddr,
unsigned long addr, size_t len);
/**
* remote_clone() - perform a clone() system call in remote process
* @pid: PID of the target process
* @syscall_insn_vaddr: virtual address of SYSCALL instruction
* @flags: clone argument: flags
* @stack_vaddr: clone argument: virtual address of the stack
*
* This function preserves the register state of the process.
*
* Returns: TID of the newly created process, or zero in case of error.
*/
pid_t remote_clone(pid_t pid, unsigned long syscall_insn_vaddr,
unsigned long flags, unsigned long stack_vaddr);
#endif /* LINUX_CRT_SYSCALL_H */