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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jed Davis 2019-08-14 22:48:33 +00:00
Родитель e3f21b94e9
Коммит 8692675af1
2 изменённых файлов: 38 добавлений и 18 удалений

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

@ -291,7 +291,7 @@ add_task(async function() {
});
}
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];
@ -345,15 +345,25 @@ add_task(async function() {
continue;
}
if (!WIN) {
if (filename == "/dev/urandom") {
continue;
}
if (!WIN && filename == "/dev/urandom") {
continue;
}
// Ignore I/O due to IPC. This doesn't really touch the disk.
if (filename.startsWith(tmpPath + "/org.chromium.")) {
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;
}
// 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;

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

@ -884,7 +884,7 @@ add_task(async function() {
});
}
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];
@ -919,15 +919,25 @@ add_task(async function() {
continue;
}
if (!WIN) {
if (filename == "/dev/urandom") {
continue;
}
if (!WIN && filename == "/dev/urandom") {
continue;
}
// Ignore I/O due to IPC. This doesn't really touch the disk.
if (filename.startsWith(tmpPath + "/org.chromium.")) {
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;
}
// 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;