Loading src/client/intercept.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -747,20 +747,22 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4, reinterpret_cast<const char*>(arg1), 0); break; #endif #ifdef SYS_renameat case SYS_renameat: *result = gkfs::hook::hook_renameat( static_cast<int>(arg0), reinterpret_cast<const char*>(arg1), static_cast<int>(arg2), reinterpret_cast<const char*>(arg3), 0); break; #endif #ifdef SYS_renameat2 case SYS_renameat2: *result = gkfs::hook::hook_renameat( static_cast<int>(arg0), reinterpret_cast<const char*>(arg1), static_cast<int>(arg2), reinterpret_cast<const char*>(arg3), static_cast<unsigned int>(arg4)); break; #endif case SYS_fstatfs: *result = gkfs::hook::hook_fstatfs( static_cast<unsigned int>(arg0), Loading Loading @@ -1034,9 +1036,11 @@ start_self_interception() { LOG(DEBUG, "Enabling syscall interception for self"); intercept_hook_point = internal_hook_guard_wrapper; #ifndef __riscv intercept_hook_point_post_kernel = hook_forwarded_syscall; intercept_hook_point_clone_child = hook_clone_at_child; intercept_hook_point_clone_parent = hook_clone_at_parent; #endif } void Loading @@ -1048,9 +1052,11 @@ start_interception() { // Set up the callback function pointer intercept_hook_point = hook_guard_wrapper; #ifndef __riscv intercept_hook_point_post_kernel = hook_forwarded_syscall; intercept_hook_point_clone_child = hook_clone_at_child; intercept_hook_point_clone_parent = hook_clone_at_parent; #endif } void Loading @@ -1061,9 +1067,11 @@ stop_interception() { // Reset callback function pointer intercept_hook_point = nullptr; #ifndef __riscv intercept_hook_point_post_kernel = nullptr; intercept_hook_point_clone_child = nullptr; intercept_hook_point_clone_parent = nullptr; #endif } } // namespace gkfs::preload src/client/syscalls/detail/syscall_info.c +4 −0 Original line number Diff line number Diff line Loading @@ -472,7 +472,9 @@ SYSCALL(getpmsg, 5, S_RET(rdec), S_NARG(arg, "arg0"), #endif SYSCALL(newfstatat, 4, S_RET(rdec), S_NARG(atfd, "dfd"), S_NARG(cstr, "pathname"), S_NARG(ptr, "statbuf"), S_NARG(arg, "flag")), SYSCALL(unlinkat, 3, S_RET(rdec), S_NARG(atfd, "dfd"), S_NARG(cstr, "pathname"), S_NARG(arg, "flag")), #ifdef SYS_renameat SYSCALL(renameat, 4, S_RET(rdec), S_NARG(atfd, "olddfd"), S_NARG(cstr, "oldname"), S_NARG(atfd, "newdfd"), S_NARG(cstr, "newname")), #endif SYSCALL(linkat, 5, S_RET(rdec), S_NARG(atfd, "olddfd"), S_NARG(cstr, "oldpath"), S_NARG(atfd, "newdfd"), S_NARG(cstr, "newpath"), S_NARG(arg, "flags")), SYSCALL(symlinkat, 3, S_RET(rdec), S_NARG(cstr, "oldname"), S_NARG(atfd, "newdfd"), S_NARG(cstr, "newname")), SYSCALL(readlinkat, 4, S_RET(rdec), S_NARG(atfd, "dfd"), S_NARG(cstr, "pathname"), S_NARG(ptr, "buf"), S_NARG(arg, "bufsiz")), Loading Loading @@ -1029,7 +1031,9 @@ const struct named_syscall_entry syscalls_by_name[] = { #ifdef SYS_rename SYSCALL_BY_NAME(rename), #endif #ifdef SYS_renameat SYSCALL_BY_NAME(renameat), #endif SYSCALL_BY_NAME(renameat2), SYSCALL_BY_NAME(request_key), SYSCALL_BY_NAME(restart_syscall), Loading src/client/syscalls/util.S +11 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ .text syscall_no_intercept: #ifndef __riscv movq %rdi, %rax /* convert from linux ABI calling */ movq %rsi, %rdi /* convention to syscall calling convention */ movq %rdx, %rsi Loading @@ -44,6 +45,16 @@ syscall_no_intercept: movq %r9, %r8 movq 8(%rsp), %r9 syscall #else mv a7, a0 /* convert from linux ABI calling */ mv a0, a1 /* convention to syscall calling convention */ mv a1, a2 mv a2, a3 mv a3, a4 mv a4, a5 mv a5, a6 ecall #endif ret .size syscall_no_intercept, .-syscall_no_intercept Loading
src/client/intercept.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -747,20 +747,22 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4, reinterpret_cast<const char*>(arg1), 0); break; #endif #ifdef SYS_renameat case SYS_renameat: *result = gkfs::hook::hook_renameat( static_cast<int>(arg0), reinterpret_cast<const char*>(arg1), static_cast<int>(arg2), reinterpret_cast<const char*>(arg3), 0); break; #endif #ifdef SYS_renameat2 case SYS_renameat2: *result = gkfs::hook::hook_renameat( static_cast<int>(arg0), reinterpret_cast<const char*>(arg1), static_cast<int>(arg2), reinterpret_cast<const char*>(arg3), static_cast<unsigned int>(arg4)); break; #endif case SYS_fstatfs: *result = gkfs::hook::hook_fstatfs( static_cast<unsigned int>(arg0), Loading Loading @@ -1034,9 +1036,11 @@ start_self_interception() { LOG(DEBUG, "Enabling syscall interception for self"); intercept_hook_point = internal_hook_guard_wrapper; #ifndef __riscv intercept_hook_point_post_kernel = hook_forwarded_syscall; intercept_hook_point_clone_child = hook_clone_at_child; intercept_hook_point_clone_parent = hook_clone_at_parent; #endif } void Loading @@ -1048,9 +1052,11 @@ start_interception() { // Set up the callback function pointer intercept_hook_point = hook_guard_wrapper; #ifndef __riscv intercept_hook_point_post_kernel = hook_forwarded_syscall; intercept_hook_point_clone_child = hook_clone_at_child; intercept_hook_point_clone_parent = hook_clone_at_parent; #endif } void Loading @@ -1061,9 +1067,11 @@ stop_interception() { // Reset callback function pointer intercept_hook_point = nullptr; #ifndef __riscv intercept_hook_point_post_kernel = nullptr; intercept_hook_point_clone_child = nullptr; intercept_hook_point_clone_parent = nullptr; #endif } } // namespace gkfs::preload
src/client/syscalls/detail/syscall_info.c +4 −0 Original line number Diff line number Diff line Loading @@ -472,7 +472,9 @@ SYSCALL(getpmsg, 5, S_RET(rdec), S_NARG(arg, "arg0"), #endif SYSCALL(newfstatat, 4, S_RET(rdec), S_NARG(atfd, "dfd"), S_NARG(cstr, "pathname"), S_NARG(ptr, "statbuf"), S_NARG(arg, "flag")), SYSCALL(unlinkat, 3, S_RET(rdec), S_NARG(atfd, "dfd"), S_NARG(cstr, "pathname"), S_NARG(arg, "flag")), #ifdef SYS_renameat SYSCALL(renameat, 4, S_RET(rdec), S_NARG(atfd, "olddfd"), S_NARG(cstr, "oldname"), S_NARG(atfd, "newdfd"), S_NARG(cstr, "newname")), #endif SYSCALL(linkat, 5, S_RET(rdec), S_NARG(atfd, "olddfd"), S_NARG(cstr, "oldpath"), S_NARG(atfd, "newdfd"), S_NARG(cstr, "newpath"), S_NARG(arg, "flags")), SYSCALL(symlinkat, 3, S_RET(rdec), S_NARG(cstr, "oldname"), S_NARG(atfd, "newdfd"), S_NARG(cstr, "newname")), SYSCALL(readlinkat, 4, S_RET(rdec), S_NARG(atfd, "dfd"), S_NARG(cstr, "pathname"), S_NARG(ptr, "buf"), S_NARG(arg, "bufsiz")), Loading Loading @@ -1029,7 +1031,9 @@ const struct named_syscall_entry syscalls_by_name[] = { #ifdef SYS_rename SYSCALL_BY_NAME(rename), #endif #ifdef SYS_renameat SYSCALL_BY_NAME(renameat), #endif SYSCALL_BY_NAME(renameat2), SYSCALL_BY_NAME(request_key), SYSCALL_BY_NAME(restart_syscall), Loading
src/client/syscalls/util.S +11 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ .text syscall_no_intercept: #ifndef __riscv movq %rdi, %rax /* convert from linux ABI calling */ movq %rsi, %rdi /* convention to syscall calling convention */ movq %rdx, %rsi Loading @@ -44,6 +45,16 @@ syscall_no_intercept: movq %r9, %r8 movq 8(%rsp), %r9 syscall #else mv a7, a0 /* convert from linux ABI calling */ mv a0, a1 /* convention to syscall calling convention */ mv a1, a2 mv a2, a3 mv a3, a4 mv a4, a5 mv a5, a6 ecall #endif ret .size syscall_no_intercept, .-syscall_no_intercept