Loading src/client/gkfs_libc.cpp +23 −17 Original line number Diff line number Diff line Loading @@ -2431,9 +2431,10 @@ chmod(const char* path, mode_t mode) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2445,9 +2446,10 @@ int fchmod(int fd, mode_t mode) throw() { gkfs_init_routine_placeholder(); if(CTX->interception_enabled() && is_gkfs_fd(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } GKFS_FALLBACK(fchmod, fd, mode); } Loading @@ -2463,9 +2465,10 @@ fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2486,10 +2489,10 @@ __fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "__fchmodat operation not supported, returning success", LOG(WARNING, "__fchmodat is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2504,9 +2507,10 @@ chown(const char* path, uid_t owner, gid_t group) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2518,9 +2522,10 @@ int fchown(int fd, uid_t owner, gid_t group) throw() { gkfs_init_routine_placeholder(); if(CTX->interception_enabled() && is_gkfs_fd(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } GKFS_FALLBACK(fchown, fd, owner, group); } Loading @@ -2532,9 +2537,10 @@ lchown(const char* path, uid_t owner, gid_t group) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading src/client/hooks.cpp +40 −17 Original line number Diff line number Diff line Loading @@ -900,7 +900,22 @@ hook_mkdirat(int dirfd, const char* cpath, mode_t mode) { int hook_fchmodat(int dirfd, const char* cpath, mode_t mode, int flags) { return 0; if(cpath == nullptr) { return -EFAULT; } std::string resolved; const auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved, false); if(rstatus == gkfs::preload::RelativizeStatus::internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } if(rstatus == gkfs::preload::RelativizeStatus::fd_not_a_dir) { return -ENOTDIR; } return syscall_no_intercept_wrapper(SYS_fchmodat, dirfd, cpath, mode, flags); } int Loading @@ -908,9 +923,10 @@ hook_fchmod(unsigned int fd, mode_t mode) { LOG(DEBUG, "{}() called with fd: {}, mode: {}", __func__, fd, mode); if(CTX->file_map()->exist(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_fchmod, fd, mode); } Loading @@ -922,7 +938,13 @@ hook_chmod(const char* path, mode_t mode) { return -EFAULT; } LOG(DEBUG, "{}() called with path: \"{}\", mode: {}", __func__, path, mode); return 0; std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_chmod, path, mode); } int Loading @@ -935,9 +957,9 @@ hook_lchown(const char* path, uid_t owner, gid_t group) { std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } #ifdef SYS_lchown return syscall_no_intercept_wrapper(SYS_lchown, path, owner, group); Loading @@ -957,9 +979,9 @@ hook_chown(const char* path, uid_t owner, gid_t group) { std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } #ifdef SYS_chown return syscall_no_intercept_wrapper(SYS_chown, path, owner, group); Loading @@ -975,9 +997,10 @@ hook_fchown(unsigned int fd, uid_t owner, gid_t group) { owner, group); if(CTX->file_map()->exist(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_fchown, fd, owner, group); } Loading @@ -1002,9 +1025,9 @@ hook_fchownat(int dirfd, const char* cpath, uid_t owner, gid_t group, resolve_flags, follow); if(rstatus == gkfs::preload::RelativizeStatus::internal) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_fchownat, dirfd, cpath, owner, group, flags); Loading tests/integration/harness/gkfs.io/syscall_coverage.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1470,9 +1470,11 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { // fchmod internal rv = ::fchmod(fd, 0777); if(rv < 0) { if(errno != ENOTSUP && errno != EOPNOTSUPP && errno != ENOLCK) { output("fchmod", rv, opts); return; } } // fchmod external rv = ::fchmod(fdext, 0777); Loading @@ -1484,9 +1486,11 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { // fchmodat internal rv = ::fchmodat(AT_FDCWD, opts.pathname.c_str(), 0777, 0); if(rv < 0) { if(errno != ENOTSUP && errno != EOPNOTSUPP && errno != ENOLCK) { output("fchmodat", rv, opts); return; } } // fchmodat external rv = ::fchmodat(AT_FDCWD, tmpfile_path.c_str(), 0777, 0); if(rv < 0) { Loading Loading
src/client/gkfs_libc.cpp +23 −17 Original line number Diff line number Diff line Loading @@ -2431,9 +2431,10 @@ chmod(const char* path, mode_t mode) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2445,9 +2446,10 @@ int fchmod(int fd, mode_t mode) throw() { gkfs_init_routine_placeholder(); if(CTX->interception_enabled() && is_gkfs_fd(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } GKFS_FALLBACK(fchmod, fd, mode); } Loading @@ -2463,9 +2465,10 @@ fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2486,10 +2489,10 @@ __fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "__fchmodat operation not supported, returning success", LOG(WARNING, "__fchmodat is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2504,9 +2507,10 @@ chown(const char* path, uid_t owner, gid_t group) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2518,9 +2522,10 @@ int fchown(int fd, uid_t owner, gid_t group) throw() { gkfs_init_routine_placeholder(); if(CTX->interception_enabled() && is_gkfs_fd(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } GKFS_FALLBACK(fchown, fd, owner, group); } Loading @@ -2532,9 +2537,10 @@ lchown(const char* path, uid_t owner, gid_t group) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() operation not supported, returning success", LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); return 0; errno = ENOTSUP; return -1; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading
src/client/hooks.cpp +40 −17 Original line number Diff line number Diff line Loading @@ -900,7 +900,22 @@ hook_mkdirat(int dirfd, const char* cpath, mode_t mode) { int hook_fchmodat(int dirfd, const char* cpath, mode_t mode, int flags) { return 0; if(cpath == nullptr) { return -EFAULT; } std::string resolved; const auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved, false); if(rstatus == gkfs::preload::RelativizeStatus::internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } if(rstatus == gkfs::preload::RelativizeStatus::fd_not_a_dir) { return -ENOTDIR; } return syscall_no_intercept_wrapper(SYS_fchmodat, dirfd, cpath, mode, flags); } int Loading @@ -908,9 +923,10 @@ hook_fchmod(unsigned int fd, mode_t mode) { LOG(DEBUG, "{}() called with fd: {}, mode: {}", __func__, fd, mode); if(CTX->file_map()->exist(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_fchmod, fd, mode); } Loading @@ -922,7 +938,13 @@ hook_chmod(const char* path, mode_t mode) { return -EFAULT; } LOG(DEBUG, "{}() called with path: \"{}\", mode: {}", __func__, path, mode); return 0; std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_chmod, path, mode); } int Loading @@ -935,9 +957,9 @@ hook_lchown(const char* path, uid_t owner, gid_t group) { std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } #ifdef SYS_lchown return syscall_no_intercept_wrapper(SYS_lchown, path, owner, group); Loading @@ -957,9 +979,9 @@ hook_chown(const char* path, uid_t owner, gid_t group) { std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } #ifdef SYS_chown return syscall_no_intercept_wrapper(SYS_chown, path, owner, group); Loading @@ -975,9 +997,10 @@ hook_fchown(unsigned int fd, uid_t owner, gid_t group) { owner, group); if(CTX->file_map()->exist(fd)) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS fd '{}'", __func__, fd); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_fchown, fd, owner, group); } Loading @@ -1002,9 +1025,9 @@ hook_fchownat(int dirfd, const char* cpath, uid_t owner, gid_t group, resolve_flags, follow); if(rstatus == gkfs::preload::RelativizeStatus::internal) { LOG(WARNING, "{}() operation not supported, returning success", __func__); return 0; LOG(WARNING, "{}() chown is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; } return syscall_no_intercept_wrapper(SYS_fchownat, dirfd, cpath, owner, group, flags); Loading
tests/integration/harness/gkfs.io/syscall_coverage.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1470,9 +1470,11 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { // fchmod internal rv = ::fchmod(fd, 0777); if(rv < 0) { if(errno != ENOTSUP && errno != EOPNOTSUPP && errno != ENOLCK) { output("fchmod", rv, opts); return; } } // fchmod external rv = ::fchmod(fdext, 0777); Loading @@ -1484,9 +1486,11 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { // fchmodat internal rv = ::fchmodat(AT_FDCWD, opts.pathname.c_str(), 0777, 0); if(rv < 0) { if(errno != ENOTSUP && errno != EOPNOTSUPP && errno != ENOLCK) { output("fchmodat", rv, opts); return; } } // fchmodat external rv = ::fchmodat(AT_FDCWD, tmpfile_path.c_str(), 0777, 0); if(rv < 0) { Loading