Bug 1479960 - Fix the main thread I/O tests to handle the IPC shared memory changes. r=florian
authorJed Davis <jld@mozilla.com>
Wed, 14 Aug 2019 22:48:33 +0000
changeset 488046 ddfa5ff8106195214d932cedc963fe2f9191c5d0
parent 488045 6da235c5a77c5fc23b11a7456c588974f1de878c
child 488047 225411558a4eaa436ef6036eee1513427a156413
push id36434
push usercbrindusan@mozilla.com
push dateThu, 15 Aug 2019 09:44:30 +0000
treeherdermozilla-central@144fbfb409b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1479960
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1479960 - Fix the main thread I/O tests to handle the IPC shared memory changes. r=florian The tests for unexpected main thread I/O had exemptions for the specific paths that were being used for shared memory, which would cause it to fail with the changes in this bug. This patch does two things: 1. On Linux, /dev/shm is always tmpfs (a memory filesystem), so it's not going to cause disk I/O, and it's used by glibc to implement the POSIX standard shm_open API. This allows all /dev/shm paths instead of limiting it to a hard-coded prefix. 2. On MacOS, with the patches in this bug, we'll no longer use temporary files for shared memory on current OS versions, but we still need them on older versions to avoid an OS bug (https://crbug.com/project-zero/1671), and they are backed by disk in this case, so we want to allow only the IPC files. However, the path prefix has changed. Differential Revision: https://phabricator.services.mozilla.com/D34628
browser/base/content/test/performance/browser_startup_content_mainthreadio.js
browser/base/content/test/performance/browser_startup_mainthreadio.js
--- a/browser/base/content/test/performance/browser_startup_content_mainthreadio.js
+++ b/browser/base/content/test/performance/browser_startup_content_mainthreadio.js
@@ -286,17 +286,17 @@ add_task(async function() {
     processes[process] = processes[process].filter(
       entry => !("condition" in entry) || entry.condition
     );
     processes[process].forEach(entry => {
       entry.path = expandWhitelistPath(entry.path, entry.canonicalize);
     });
   }
 
-  let tmpPath = expandWhitelistPath(MAC ? "TmpD:" : "/dev/shm").toLowerCase();
+  let tmpPath = expandWhitelistPath("TmpD:").toLowerCase();
   let shouldPass = true;
   for (let procName in processes) {
     let whitelist = processes[procName];
     info(
       `whitelisted paths for ${procName} process:\n` +
         whitelist
           .map(e => {
             let operations = Object.keys(e)
@@ -340,25 +340,35 @@ add_task(async function() {
       let filename = marker.filename.toLowerCase();
 
       if (!filename) {
         // We are still missing the filename on some mainthreadio markers,
         // these markers are currently useless for the purpose of this test.
         continue;
       }
 
-      if (!WIN) {
-        if (filename == "/dev/urandom") {
-          continue;
-        }
+      if (!WIN && filename == "/dev/urandom") {
+        continue;
+      }
+
+      // /dev/shm is always tmpfs (a memory filesystem); this isn't
+      // really I/O any more than mmap/munmap are.
+      if (LINUX && filename.startsWith("/dev/shm/")) {
+        continue;
+      }
 
-        // Ignore I/O due to IPC. This doesn't really touch the disk.
-        if (filename.startsWith(tmpPath + "/org.chromium.")) {
-          continue;
-        }
+      // Shared memory uses temporary files on MacOS <= 10.11 to avoid
+      // a kernel security bug that will never be patched (see
+      // https://crbug.com/project-zero/1671 for details).  This can
+      // be removed when we no longer support those OS versions.
+      //
+      // The org.chromium prefix will be removed in bug 1426526.
+      if (MAC && (filename.startsWith(tmpPath + "/org.chromium.") ||
+                  filename.startsWith(tmpPath + "/org.mozilla.ipc."))) {
+        continue;
       }
 
       let expected = false;
       for (let entry of whitelist) {
         if (pathMatches(entry.path, filename)) {
           entry[marker.operation] = (entry[marker.operation] || 0) - 1;
           entry._used = true;
           expected = true;
--- a/browser/base/content/test/performance/browser_startup_mainthreadio.js
+++ b/browser/base/content/test/performance/browser_startup_mainthreadio.js
@@ -879,17 +879,17 @@ add_task(async function() {
     startupPhases[phase] = startupPhases[phase].filter(
       entry => !("condition" in entry) || entry.condition
     );
     startupPhases[phase].forEach(entry => {
       entry.path = expandWhitelistPath(entry.path, entry.canonicalize);
     });
   }
 
-  let tmpPath = expandWhitelistPath(MAC ? "TmpD:" : "/dev/shm").toLowerCase();
+  let tmpPath = expandWhitelistPath("TmpD:").toLowerCase();
   let shouldPass = true;
   for (let phase in phases) {
     let whitelist = startupPhases[phase];
     info(
       `whitelisted paths ${phase}:\n` +
         whitelist
           .map(e => {
             let operations = Object.keys(e)
@@ -914,25 +914,35 @@ add_task(async function() {
       let filename = marker.filename.toLowerCase();
 
       if (!filename) {
         // We are still missing the filename on some mainthreadio markers,
         // these markers are currently useless for the purpose of this test.
         continue;
       }
 
-      if (!WIN) {
-        if (filename == "/dev/urandom") {
-          continue;
-        }
+      if (!WIN && filename == "/dev/urandom") {
+        continue;
+      }
+
+      // /dev/shm is always tmpfs (a memory filesystem); this isn't
+      // really I/O any more than mmap/munmap are.
+      if (LINUX && filename.startsWith("/dev/shm/")) {
+        continue;
+      }
 
-        // Ignore I/O due to IPC. This doesn't really touch the disk.
-        if (filename.startsWith(tmpPath + "/org.chromium.")) {
-          continue;
-        }
+      // Shared memory uses temporary files on MacOS <= 10.11 to avoid
+      // a kernel security bug that will never be patched (see
+      // https://crbug.com/project-zero/1671 for details).  This can
+      // be removed when we no longer support those OS versions.
+      //
+      // The org.chromium prefix will be removed in bug 1426526.
+      if (MAC && (filename.startsWith(tmpPath + "/org.chromium.") ||
+                  filename.startsWith(tmpPath + "/org.mozilla.ipc."))) {
+        continue;
       }
 
       let expected = false;
       for (let entry of whitelist) {
         if (pathMatches(entry.path, filename)) {
           entry[marker.operation] = (entry[marker.operation] || 0) - 1;
           entry._used = true;
           expected = true;