Loading include/client/preload.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -63,4 +63,11 @@ void at_child(); void at_parent(); void at_fork_syscall(); void at_child_syscall(); void at_parent_syscall(); #endif // IOINTERCEPT_PRELOAD_HPP src/client/gkfs_libc.cpp +1 −8 Original line number Diff line number Diff line Loading @@ -1274,7 +1274,6 @@ lseek(int fd, off_t offset, int whence) { initializeGekko(); // Is fd from GekkoFS? if(CTX->file_map()->exist(fd)) { debug_info("[xLSEEK GEKKO]....%ld %d\n", offset, whence); return gkfs::syscall::gkfs_lseek(fd, offset, whence); } Loading @@ -1289,7 +1288,6 @@ lseek64(int fd, off64_t offset, int whence) { // Is fd from GekkoFS? initializeGekko(); if(CTX->file_map()->exist(fd)) { debug_info("[LSEEK64 GEKKO]... %d.%ld %d\n", fd, offset, whence); return gkfs::syscall::gkfs_lseek(fd, offset, whence); } Loading Loading @@ -2095,8 +2093,6 @@ opendir(const char* dirname) { struct stat st; if(gkfs::syscall::gkfs_stat(resolved, &st) != 0 or S_ISREG(st.st_mode)) { debug_info("[BYPASS] >> opendir GKFS NOT A DIR.... %s\n", dirname); errno = ENOTDIR; return NULL; } Loading Loading @@ -2133,8 +2129,6 @@ opendir64(const char* dirname) { auto rstatus = CTX->relativize_fd_path(AT_FDCWD, dirname, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: debug_info("[BYPASS] >> opendir64 GKFS NOT A DIR.... %s\n", dirname); errno = ENOTDIR; return NULL; Loading @@ -2146,8 +2140,7 @@ opendir64(const char* dirname) { struct stat st; if(gkfs::syscall::gkfs_stat(resolved, &st) != 0 or S_ISREG(st.st_mode)) { debug_info("[BYPASS] >> opendir64 GKFS NOT A DIR.... %s\n", dirname); errno = ENOTDIR; return NULL; } Loading src/client/preload.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ init_preload() { // The original errno value will be restored after initialization to not // leak internal error codes auto oerrno = errno; pthread_atfork(&at_fork_syscall, &at_parent_syscall, &at_child_syscall); CTX->enable_interception(); gkfs::preload::start_self_interception(); Loading Loading @@ -513,3 +513,25 @@ at_child() { init_libc(); 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()); destroy_preload(); } void at_parent_syscall() { 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()); } void at_child_syscall() { 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()); } Loading
include/client/preload.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -63,4 +63,11 @@ void at_child(); void at_parent(); void at_fork_syscall(); void at_child_syscall(); void at_parent_syscall(); #endif // IOINTERCEPT_PRELOAD_HPP
src/client/gkfs_libc.cpp +1 −8 Original line number Diff line number Diff line Loading @@ -1274,7 +1274,6 @@ lseek(int fd, off_t offset, int whence) { initializeGekko(); // Is fd from GekkoFS? if(CTX->file_map()->exist(fd)) { debug_info("[xLSEEK GEKKO]....%ld %d\n", offset, whence); return gkfs::syscall::gkfs_lseek(fd, offset, whence); } Loading @@ -1289,7 +1288,6 @@ lseek64(int fd, off64_t offset, int whence) { // Is fd from GekkoFS? initializeGekko(); if(CTX->file_map()->exist(fd)) { debug_info("[LSEEK64 GEKKO]... %d.%ld %d\n", fd, offset, whence); return gkfs::syscall::gkfs_lseek(fd, offset, whence); } Loading Loading @@ -2095,8 +2093,6 @@ opendir(const char* dirname) { struct stat st; if(gkfs::syscall::gkfs_stat(resolved, &st) != 0 or S_ISREG(st.st_mode)) { debug_info("[BYPASS] >> opendir GKFS NOT A DIR.... %s\n", dirname); errno = ENOTDIR; return NULL; } Loading Loading @@ -2133,8 +2129,6 @@ opendir64(const char* dirname) { auto rstatus = CTX->relativize_fd_path(AT_FDCWD, dirname, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: debug_info("[BYPASS] >> opendir64 GKFS NOT A DIR.... %s\n", dirname); errno = ENOTDIR; return NULL; Loading @@ -2146,8 +2140,7 @@ opendir64(const char* dirname) { struct stat st; if(gkfs::syscall::gkfs_stat(resolved, &st) != 0 or S_ISREG(st.st_mode)) { debug_info("[BYPASS] >> opendir64 GKFS NOT A DIR.... %s\n", dirname); errno = ENOTDIR; return NULL; } Loading
src/client/preload.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ init_preload() { // The original errno value will be restored after initialization to not // leak internal error codes auto oerrno = errno; pthread_atfork(&at_fork_syscall, &at_parent_syscall, &at_child_syscall); CTX->enable_interception(); gkfs::preload::start_self_interception(); Loading Loading @@ -513,3 +513,25 @@ at_child() { init_libc(); 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()); destroy_preload(); } void at_parent_syscall() { 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()); } void at_child_syscall() { 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()); }