Bug 1480755 - Add support for new Mesa device probing. r=jld

MozReview-Commit-ID: CD9ATGHUOZ1

Differential Revision: https://phabricator.services.mozilla.com/D3910

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gian-Carlo Pascutto 2018-08-22 01:52:44 +00:00
parent 11358a959e
commit ac0adb0b5e

View File

@ -63,6 +63,9 @@ AddMesaSysfsPaths(SandboxBroker::Policy* aPolicy)
// Bug 1384178: Mesa driver loader
aPolicy->AddPrefix(rdonly, "/sys/dev/char/226:");
// Bug 1480755: Mesa tries to probe /sys paths in turn
aPolicy->AddAncestors("/sys/dev/char/");
// Bug 1401666: Mesa driver loader part 2: Mesa <= 12 using libudev
if (auto dir = opendir("/dev/dri")) {
while (auto entry = readdir(dir)) {
@ -84,10 +87,22 @@ AddMesaSysfsPaths(SandboxBroker::Policy* aPolicy)
// broker. To match this, allow the canonical paths.
UniqueFreePtr<char[]> realSysPath(realpath(sysPath.get(), nullptr));
if (realSysPath) {
nsPrintfCString ueventPath("%s/uevent", realSysPath.get());
nsPrintfCString configPath("%s/config", realSysPath.get());
aPolicy->AddPath(rdonly, ueventPath.get());
aPolicy->AddPath(rdonly, configPath.get());
static const Array<const char*, 7> kMesaAttrSuffixes = {
"revision",
"vendor",
"device",
"subsystem_vendor",
"subsystem_device",
"uevent",
"config"
};
for (const auto attrSuffix : kMesaAttrSuffixes) {
nsPrintfCString attrPath("%s/%s", realSysPath.get(), attrSuffix);
aPolicy->AddPath(rdonly, attrPath.get());
}
// Allowing stat-ing the parent dirs
nsPrintfCString basePath("%s/", realSysPath.get());
aPolicy->AddAncestors(basePath.get());
}
}
}