mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
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:
parent
271c9183fa
commit
08c45b9f68
@ -243,6 +243,12 @@ class SandboxPolicyCommon : public SandboxPolicyBase {
|
|||||||
auto path = reinterpret_cast<const char*>(aArgs.args[1]);
|
auto path = reinterpret_cast<const char*>(aArgs.args[1]);
|
||||||
auto buf = reinterpret_cast<statstruct*>(aArgs.args[2]);
|
auto buf = reinterpret_cast<statstruct*>(aArgs.args[2]);
|
||||||
auto flags = static_cast<int>(aArgs.args[3]);
|
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] != '/') {
|
if (fd != AT_FDCWD && path[0] != '/') {
|
||||||
SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)",
|
SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)",
|
||||||
fd, path, buf, flags);
|
fd, path, buf, flags);
|
||||||
|
@ -19,10 +19,12 @@
|
|||||||
typedef struct stat64 statstruct;
|
typedef struct stat64 statstruct;
|
||||||
# define statsyscall stat64
|
# define statsyscall stat64
|
||||||
# define lstatsyscall lstat64
|
# define lstatsyscall lstat64
|
||||||
|
# define fstatsyscall fstat64
|
||||||
#elif defined(__NR_stat)
|
#elif defined(__NR_stat)
|
||||||
typedef struct stat statstruct;
|
typedef struct stat statstruct;
|
||||||
# define statsyscall stat
|
# define statsyscall stat
|
||||||
# define lstatsyscall lstat
|
# define lstatsyscall lstat
|
||||||
|
# define fstatsyscall fstat
|
||||||
#else
|
#else
|
||||||
# error Missing stat syscall include.
|
# error Missing stat syscall include.
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user