Bug 1384804 - Allow reading /proc/self/status for libnuma. r=jld, a=ritu
authorGian-Carlo Pascutto <gcp@mozilla.com>
Thu, 28 Sep 2017 16:19:02 +0200
changeset 677876 4a1a1eab35ce97053558e791745a02b616983c66
parent 677875 3d3fb23661100dbd4a2b47d692029fc332fe4fcb
child 677877 f31efa9dfa8fc6161df364ee6bcd7a7469582ed3
push id83805
push userbmo:rail@mozilla.com
push dateTue, 10 Oct 2017 19:01:30 +0000
reviewersjld, ritu
bugs1384804
milestone57.0
Bug 1384804 - Allow reading /proc/self/status for libnuma. r=jld, a=ritu MozReview-Commit-ID: LLwmPVtj0PE
security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
--- a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
+++ b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
@@ -242,17 +242,19 @@ SandboxBrokerPolicyFactory::SandboxBroke
 #endif
 }
 
 #ifdef MOZ_CONTENT_SANDBOX
 UniquePtr<SandboxBroker::Policy>
 SandboxBrokerPolicyFactory::GetContentPolicy(int aPid, bool aFileProcess)
 {
   // Policy entries that vary per-process (currently the only reason
-  // that can happen is because they contain the pid) are added here.
+  // that can happen is because they contain the pid) are added here,
+  // as well as entries that depend on preferences or paths not available
+  // in early startup.
 
   MOZ_ASSERT(NS_IsMainThread());
   // File broker usage is controlled through a pref.
   if (GetEffectiveContentSandboxLevel() <= 1) {
     return nullptr;
   }
 
   MOZ_ASSERT(mCommonContentPolicy);
@@ -283,16 +285,21 @@ SandboxBrokerPolicyFactory::GetContentPo
 
   // Bug 1198550: the profiler's replacement for dl_iterate_phdr
   policy->AddPath(rdonly, nsPrintfCString("/proc/%d/maps", aPid).get());
 
   // Bug 1198552: memory reporting.
   policy->AddPath(rdonly, nsPrintfCString("/proc/%d/statm", aPid).get());
   policy->AddPath(rdonly, nsPrintfCString("/proc/%d/smaps", aPid).get());
 
+  // Bug 1384804, notably comment 15
+  // Used by libnuma, included by x265/ffmpeg, who falls back
+  // to get_mempolicy if this fails
+  policy->AddPath(rdonly, nsPrintfCString("/proc/%d/status", aPid).get());
+
   // userContent.css and the extensions dir sit in the profile, which is
   // normally blocked and we can't get the profile dir earlier in startup,
   // so this must happen here.
   nsCOMPtr<nsIFile> profileDir;
   nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
                                        getter_AddRefs(profileDir));
   if (NS_SUCCEEDED(rv)) {
       nsCOMPtr<nsIFile> workDir;