syscall hook
This commit is contained in:
parent
ea89e5a32c
commit
beb8bf68be
@ -13256,8 +13256,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
||||
|
||||
//// --- Begin LibAFL code ---
|
||||
|
||||
int (*libafl_syscall_hook)(uint64_t*, int, uint64_t, uint64_t, uint64_t,
|
||||
uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
|
||||
struct syshook_ret {
|
||||
uint64_t retval;
|
||||
bool skip_syscall;
|
||||
};
|
||||
struct syshook_ret (*libafl_syscall_hook)(int, uint64_t, uint64_t, uint64_t,
|
||||
uint64_t, uint64_t, uint64_t,
|
||||
uint64_t, uint64_t);
|
||||
|
||||
//// --- End LibAFL code ---
|
||||
|
||||
@ -13292,8 +13297,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
|
||||
//// --- Begin LibAFL code ---
|
||||
|
||||
uint64_t ret64;
|
||||
if (libafl_syscall_hook && libafl_syscall_hook(&ret64, num,
|
||||
if (libafl_syscall_hook) {
|
||||
struct syshook_ret hook_ret = libafl_syscall_hook(num,
|
||||
(uint64_t)arg1,
|
||||
(uint64_t)arg2,
|
||||
(uint64_t)arg3,
|
||||
@ -13301,10 +13306,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
(uint64_t)arg5,
|
||||
(uint64_t)arg6,
|
||||
(uint64_t)arg7,
|
||||
(uint64_t)arg8)) {
|
||||
ret = (abi_ulong)ret64;
|
||||
(uint64_t)arg8);
|
||||
if (hook_ret.skip_syscall) {
|
||||
ret = (abi_ulong)hook_ret.retval;
|
||||
goto after_syscall;
|
||||
}
|
||||
}
|
||||
|
||||
//// --- End LibAFL code ---
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user