Bug 1660901 - Support the fstat-like subset of fstatat in the Linux sandbox policies. r=gcp

Differential Revision: https://phabricator.services.mozilla.com/D88499
This commit is contained in:
Jed Davis 2020-08-28 09:23:58 +00:00
Родитель 271c9183fa
Коммит 08c45b9f68
2 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -243,6 +243,12 @@ class SandboxPolicyCommon : public SandboxPolicyBase {
auto path = reinterpret_cast<const char*>(aArgs.args[1]);
auto buf = reinterpret_cast<statstruct*>(aArgs.args[2]);
auto flags = static_cast<int>(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);

Просмотреть файл

@ -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