Bug 1788596 - Merge UtilityAudioDecoderSandboxPolicy into UtilitySandboxPolicy r=jld

Differential Revision: https://phabricator.services.mozilla.com/D156284
This commit is contained in:
Alexandre Lissy 2022-10-06 06:14:05 +00:00
Родитель ea20b7a843
Коммит 592b1be2e3
3 изменённых файлов: 4 добавлений и 30 удалений

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

@ -751,11 +751,8 @@ void SetUtilitySandbox(int aBroker, ipc::SandboxingKind aKind) {
UniquePtr<sandbox::bpf_dsl::Policy> policy;
switch (aKind) {
case ipc::SandboxingKind::GENERIC_UTILITY:
policy = GetUtilitySandboxPolicy(sBroker);
break;
case ipc::SandboxingKind::UTILITY_AUDIO_DECODING_GENERIC:
policy = GetUtilityAudioDecoderSandboxPolicy(sBroker);
policy = GetUtilitySandboxPolicy(sBroker);
break;
default:

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

@ -2090,26 +2090,6 @@ class UtilitySandboxPolicy : public SandboxPolicyCommon {
case __NR_getrusage:
return Allow();
// Pass through the common policy.
default:
return SandboxPolicyCommon::EvaluateSyscall(sysno);
}
}
};
UniquePtr<sandbox::bpf_dsl::Policy> GetUtilitySandboxPolicy(
SandboxBrokerClient* aMaybeBroker) {
return UniquePtr<sandbox::bpf_dsl::Policy>(
new UtilitySandboxPolicy(aMaybeBroker));
}
class UtilityAudioDecoderSandboxPolicy final : public UtilitySandboxPolicy {
public:
explicit UtilityAudioDecoderSandboxPolicy(SandboxBrokerClient* aBroker)
: UtilitySandboxPolicy(aBroker) {}
ResultExpr EvaluateSyscall(int sysno) const override {
switch (sysno) {
// Required by FFmpeg
case __NR_get_mempolicy:
return Allow();
@ -2126,15 +2106,15 @@ class UtilityAudioDecoderSandboxPolicy final : public UtilitySandboxPolicy {
// Pass through the common policy.
default:
return UtilitySandboxPolicy::EvaluateSyscall(sysno);
return SandboxPolicyCommon::EvaluateSyscall(sysno);
}
}
};
UniquePtr<sandbox::bpf_dsl::Policy> GetUtilityAudioDecoderSandboxPolicy(
UniquePtr<sandbox::bpf_dsl::Policy> GetUtilitySandboxPolicy(
SandboxBrokerClient* aMaybeBroker) {
return UniquePtr<sandbox::bpf_dsl::Policy>(
new UtilityAudioDecoderSandboxPolicy(aMaybeBroker));
new UtilitySandboxPolicy(aMaybeBroker));
}
} // namespace mozilla

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

@ -41,9 +41,6 @@ UniquePtr<sandbox::bpf_dsl::Policy> GetSocketProcessSandboxPolicy(
UniquePtr<sandbox::bpf_dsl::Policy> GetUtilitySandboxPolicy(
SandboxBrokerClient* aMaybeBroker);
UniquePtr<sandbox::bpf_dsl::Policy> GetUtilityAudioDecoderSandboxPolicy(
SandboxBrokerClient* aMaybeBroker);
} // namespace mozilla
#endif