Bug 993145 - Skip attempting seccomp sandboxing if seccomp unavailable. r=kang

This commit is contained in:
Jed Davis 2014-04-09 15:23:00 +02:00
parent 8902a00c07
commit f8ce2f4279

View File

@ -386,6 +386,14 @@ BroadcastSetThreadSandbox()
SetThreadSandbox();
}
// This function can overapproximate (i.e., return true even if
// sandboxing isn't supported, but not the reverse). See bug 993145.
static bool
IsSandboxingSupported(void)
{
return prctl(PR_GET_SECCOMP) != -1;
}
/**
* Starts the seccomp sandbox for this process and sets user/group-based privileges.
* Should be called only once, and before any potentially harmful content is loaded.
@ -408,7 +416,9 @@ SetCurrentProcessSandbox()
}
#endif
BroadcastSetThreadSandbox();
if (IsSandboxingSupported()) {
BroadcastSetThreadSandbox();
}
}
} // namespace mozilla