From c5f7ab0639205b85af35213a09ad8771bc50720d Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Mon, 30 Mar 2020 16:14:17 +0000 Subject: [PATCH] Bug 1622728 - Allow file seals in content process sandbox policy, for Wayland. r=gcp Differential Revision: https://phabricator.services.mozilla.com/D68664 --HG-- extra : moz-landing-system : lando --- security/sandbox/linux/SandboxFilter.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp index 80b5005c0525..265d9b73edac 100644 --- a/security/sandbox/linux/SandboxFilter.cpp +++ b/security/sandbox/linux/SandboxFilter.cpp @@ -70,6 +70,20 @@ using namespace sandbox::bpf_dsl; // actual value because it shows up in file flags. #define O_LARGEFILE_REAL 00100000 +#ifndef F_LINUX_SPECIFIC_BASE +# define F_LINUX_SPECIFIC_BASE 1024 +#else +static_assert(F_LINUX_SPECIFIC_BASE == 1024); +#endif + +#ifndef F_ADD_SEALS +# define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) +# define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) +#else +static_assert(F_ADD_SEALS == (F_LINUX_SPECIFIC_BASE + 9)); +static_assert(F_GET_SEALS == (F_LINUX_SPECIFIC_BASE + 10)); +#endif + // To avoid visual confusion between "ifdef ANDROID" and "ifndef ANDROID": #ifndef ANDROID # define DESKTOP @@ -1118,6 +1132,9 @@ class ContentSandboxPolicy : public SandboxPolicyCommon { #ifdef F_SETLKW64 .Case(F_SETLKW64, Allow()) #endif + // Wayland client libraries use file seals + .Case(F_ADD_SEALS, Allow()) + .Case(F_GET_SEALS, Allow()) .Default(SandboxPolicyCommon::EvaluateSyscall(sysno)); }