diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp index e522d61e065c..4087bdc07e01 100644 --- a/security/sandbox/linux/SandboxFilter.cpp +++ b/security/sandbox/linux/SandboxFilter.cpp @@ -243,6 +243,12 @@ class SandboxPolicyCommon : public SandboxPolicyBase { auto path = reinterpret_cast(aArgs.args[1]); auto buf = reinterpret_cast(aArgs.args[2]); auto flags = static_cast(aArgs.args[3]); + + if (fd != AT_FDCWD && (flags & AT_EMPTY_PATH) != 0 && + strcmp(path, "") == 0) { + return ConvertError(fstatsyscall(fd, buf)); + } + if (fd != AT_FDCWD && path[0] != '/') { SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)", fd, path, buf, flags); diff --git a/security/sandbox/linux/broker/SandboxBrokerUtils.h b/security/sandbox/linux/broker/SandboxBrokerUtils.h index 85a006740c2c..db33b5028e77 100644 --- a/security/sandbox/linux/broker/SandboxBrokerUtils.h +++ b/security/sandbox/linux/broker/SandboxBrokerUtils.h @@ -19,10 +19,12 @@ typedef struct stat64 statstruct; # define statsyscall stat64 # define lstatsyscall lstat64 +# define fstatsyscall fstat64 #elif defined(__NR_stat) typedef struct stat statstruct; # define statsyscall stat # define lstatsyscall lstat +# define fstatsyscall fstat #else # error Missing stat syscall include. #endif