Loading src/client/gkfs_libc.cpp +6 −15 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include <cstdarg> #include <client/gkfs_libc.hpp> #include <client/user_functions.hpp> #include <client/hooks.hpp> #include <atomic> #include <client/preload_context.hpp> #include <client/preload.hpp> Loading Loading @@ -708,7 +709,6 @@ dlsym_exit(int status) { // File/Directory Metadata API int dlsym_chdir(char* path) { debug_info("[SYSCALL_PROXIES] [dlsym_chdir] >> Begin\n"); if(real_chdir == NULL) { real_chdir = (int (*)(char*)) dlsym(RTLD_NEXT, "chdir"); Loading @@ -716,7 +716,6 @@ dlsym_chdir(char* path) { int ret = real_chdir((char*) path); debug_info("[SYSCALL_PROXIES] [dlsym_chdir] >> End\n"); return ret; } Loading Loading @@ -981,7 +980,6 @@ open64(const char* path, int flags, ...) { int openat(int dirfd, const char* path, int flags, ...) { debug_info("[BYPASS] >> openat.... %s %o\n", path, flags); int ret, fd; va_list ap; mode_t mode = 0; Loading @@ -1007,19 +1005,9 @@ openat(int dirfd, const char* path, int flags, ...) { // Try normal open. break; } } else { std::string p = path; debug_info("[BYPASS] >> Begin openat. ERROR...%s\n", path); if(p.find("mnt") != std::string::npos) { gkfs::preload::init_environment(); CTX->enable_interception(); debug_info("[BYPASS] >> Reinited. ERROR...%s %d\n", path, CTX->interception_enabled()); return openat(dirfd, (char*) path, flags, mode); } } ret = dlsym_openat(dirfd, (char*) path, flags, mode); va_end(ap); Loading Loading @@ -1852,6 +1840,8 @@ chdir(const char* path) { int ret = -1; initializeGekko(); // is the path from gekkofs return gkfs::hook::hook_chdir(path); /* if(CTX->interception_enabled()) { std::string resolved; Loading @@ -1862,7 +1852,7 @@ chdir(const char* path) { return -ENOTDIR; case gkfs::preload::RelativizeStatus::internal: return -ENOTDIR; return ( default: // Try normal open. Loading @@ -1874,6 +1864,7 @@ chdir(const char* path) { ret = dlsym_chdir((char*) path); debug_info("[BYPASS] << After chdir()\n"); */ return ret; } Loading src/client/preload.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -495,43 +495,43 @@ destroy_libc() { void at_fork() { printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); destroy_libc(); } void at_parent() { printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); init_libc(); printf("%d -> x At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork parent %d\n", gettid(), // CTX->interception_enabled()); } void at_child() { printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); init_libc(); printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); } void at_fork_syscall() { printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); destroy_preload(); } void at_parent_syscall() { printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork parent %d\n", gettid(), // CTX->interception_enabled()); } void at_child_syscall() { printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); } Loading
src/client/gkfs_libc.cpp +6 −15 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include <cstdarg> #include <client/gkfs_libc.hpp> #include <client/user_functions.hpp> #include <client/hooks.hpp> #include <atomic> #include <client/preload_context.hpp> #include <client/preload.hpp> Loading Loading @@ -708,7 +709,6 @@ dlsym_exit(int status) { // File/Directory Metadata API int dlsym_chdir(char* path) { debug_info("[SYSCALL_PROXIES] [dlsym_chdir] >> Begin\n"); if(real_chdir == NULL) { real_chdir = (int (*)(char*)) dlsym(RTLD_NEXT, "chdir"); Loading @@ -716,7 +716,6 @@ dlsym_chdir(char* path) { int ret = real_chdir((char*) path); debug_info("[SYSCALL_PROXIES] [dlsym_chdir] >> End\n"); return ret; } Loading Loading @@ -981,7 +980,6 @@ open64(const char* path, int flags, ...) { int openat(int dirfd, const char* path, int flags, ...) { debug_info("[BYPASS] >> openat.... %s %o\n", path, flags); int ret, fd; va_list ap; mode_t mode = 0; Loading @@ -1007,19 +1005,9 @@ openat(int dirfd, const char* path, int flags, ...) { // Try normal open. break; } } else { std::string p = path; debug_info("[BYPASS] >> Begin openat. ERROR...%s\n", path); if(p.find("mnt") != std::string::npos) { gkfs::preload::init_environment(); CTX->enable_interception(); debug_info("[BYPASS] >> Reinited. ERROR...%s %d\n", path, CTX->interception_enabled()); return openat(dirfd, (char*) path, flags, mode); } } ret = dlsym_openat(dirfd, (char*) path, flags, mode); va_end(ap); Loading Loading @@ -1852,6 +1840,8 @@ chdir(const char* path) { int ret = -1; initializeGekko(); // is the path from gekkofs return gkfs::hook::hook_chdir(path); /* if(CTX->interception_enabled()) { std::string resolved; Loading @@ -1862,7 +1852,7 @@ chdir(const char* path) { return -ENOTDIR; case gkfs::preload::RelativizeStatus::internal: return -ENOTDIR; return ( default: // Try normal open. Loading @@ -1874,6 +1864,7 @@ chdir(const char* path) { ret = dlsym_chdir((char*) path); debug_info("[BYPASS] << After chdir()\n"); */ return ret; } Loading
src/client/preload.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -495,43 +495,43 @@ destroy_libc() { void at_fork() { printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); destroy_libc(); } void at_parent() { printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); init_libc(); printf("%d -> x At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork parent %d\n", gettid(), // CTX->interception_enabled()); } void at_child() { printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); init_libc(); printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); } void at_fork_syscall() { printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); destroy_preload(); } void at_parent_syscall() { printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork parent %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork parent %d\n", gettid(), // CTX->interception_enabled()); } void at_child_syscall() { printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); // printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); }