Bug 1769616 - Error(ENOSYS) for set_mempolicy() on Content and Utility AudioDecoder r=jld

Differential Revision: https://phabricator.services.mozilla.com/D146833
This commit is contained in:
Alexandre Lissy 2022-05-21 00:01:28 +00:00
parent 25a557ba16
commit 74b64ad41e
2 changed files with 15 additions and 2 deletions

View File

@ -761,6 +761,12 @@ void RunTestsUtilityAudioDecoder(SandboxTestingChild* child) {
MPOL_F_NODE | MPOL_F_ADDR);
return rv;
});
// set_mempolicy is not allowed in Generic Utility but is on AudioDecoder
child->ErrnoValueTest("set_mempolicy"_ns, ENOSYS, [&] {
// <numaif.h> not installed by default, let's call directly the syscall
long rv = syscall(SYS_set_mempolicy, 0, NULL, 0);
return rv;
});
# elif XP_MACOSX // XP_LINUX
RunMacTestLaunchProcess(child);
RunMacTestWindowServer(child);

View File

@ -1611,6 +1611,10 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case __NR_get_mempolicy:
return Allow();
// Required by libnuma for FFmpeg
case __NR_set_mempolicy:
return Error(ENOSYS);
case __NR_kcmp:
return KcmpPolicyForMesa();
@ -2072,9 +2076,8 @@ class UtilityAudioDecoderSandboxPolicy final : public UtilitySandboxPolicy {
ResultExpr EvaluateSyscall(int sysno) const override {
switch (sysno) {
// Required by FFmpeg
case __NR_get_mempolicy: {
case __NR_get_mempolicy:
return Allow();
}
// Required by libnuma for FFmpeg
case __NR_sched_getaffinity: {
@ -2082,6 +2085,10 @@ class UtilityAudioDecoderSandboxPolicy final : public UtilitySandboxPolicy {
return If(pid == 0, Allow()).Else(Trap(SchedTrap, nullptr));
}
// Required by libnuma for FFmpeg
case __NR_set_mempolicy:
return Error(ENOSYS);
// Pass through the common policy.
default:
return UtilitySandboxPolicy::EvaluateSyscall(sysno);