From 0b8cfd1d3618487a761e5775b9d7427baabda554 Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Thu, 21 Jul 2016 09:39:09 +0200 Subject: [PATCH] Bug 1284240 - Use boolean rather than flag for Sandboxing Telemetry. r=gfritzsche MozReview-Commit-ID: EsXFAbEyxYs --HG-- extra : rebase_source : 95bbfa30597490fb1b972056651b75f5a129daad --- security/sandbox/linux/common/SandboxInfo.cpp | 34 +++++++------------ toolkit/components/telemetry/Histograms.json | 24 ++++++------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/security/sandbox/linux/common/SandboxInfo.cpp b/security/sandbox/linux/common/SandboxInfo.cpp index c1278cbbe670..8a39f3246d01 100644 --- a/security/sandbox/linux/common/SandboxInfo.cpp +++ b/security/sandbox/linux/common/SandboxInfo.cpp @@ -259,28 +259,18 @@ SandboxInfo::ThreadingCheck() SandboxInfo::SubmitTelemetry() { SandboxInfo sandboxInfo = Get(); - if (sandboxInfo.Test(SandboxInfo::kHasSeccompBPF)) { - Telemetry::Accumulate(Telemetry::SANDBOX_CAPABILITIES_SECCOMP_BPF, true); - } - if (sandboxInfo.Test(SandboxInfo::kHasSeccompTSync)) { - Telemetry::Accumulate(Telemetry::SANDBOX_CAPABILITIES_SECCOMP_TSYNC, true); - } - if (sandboxInfo.Test(SandboxInfo::kHasPrivilegedUserNamespaces)) { - Telemetry::Accumulate( - Telemetry::SANDBOX_CAPABILITIES_USER_NAMESPACES_PRIVILEGED, true); - } - if (sandboxInfo.Test(SandboxInfo::kHasUserNamespaces)) { - Telemetry::Accumulate( - Telemetry::SANDBOX_CAPABILITIES_USER_NAMESPACES, true); - } - if (sandboxInfo.Test(SandboxInfo::kEnabledForContent)) { - Telemetry::Accumulate( - Telemetry::SANDBOX_CAPABILITIES_ENABLED_CONTENT, true); - } - if (sandboxInfo.Test(SandboxInfo::kEnabledForMedia)) { - Telemetry::Accumulate( - Telemetry::SANDBOX_CAPABILITIES_ENABLED_MEDIA, true); - } + Telemetry::Accumulate(Telemetry::SANDBOX_HAS_SECCOMP_BPF, + sandboxInfo.Test(SandboxInfo::kHasSeccompBPF)); + Telemetry::Accumulate(Telemetry::SANDBOX_HAS_SECCOMP_TSYNC, + sandboxInfo.Test(SandboxInfo::kHasSeccompTSync)); + Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES_PRIVILEGED, + sandboxInfo.Test(SandboxInfo::kHasPrivilegedUserNamespaces)); + Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES, + sandboxInfo.Test(SandboxInfo::kHasUserNamespaces)); + Telemetry::Accumulate(Telemetry::SANDBOX_CONTENT_ENABLED, + sandboxInfo.Test(SandboxInfo::kEnabledForContent)); + Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED, + sandboxInfo.Test(SandboxInfo::kEnabledForMedia)); } } // namespace mozilla diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 78ad44d8ba90..6e351eb32a87 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -9829,51 +9829,51 @@ "kind": "boolean", "description": "Result of call to SandboxBroker::Initialize" }, - "SANDBOX_CAPABILITIES_SECCOMP_BPF": { + "SANDBOX_HAS_SECCOMP_BPF": { "alert_emails": ["gcp@mozilla.com"], "bug_numbers": [1098428], "expires_in_version": "55", - "kind": "flag", + "kind": "boolean", "cpp_guard": "XP_LINUX", "description": "Whether the system has seccomp-bpf capability" }, - "SANDBOX_CAPABILITIES_SECCOMP_TSYNC": { + "SANDBOX_HAS_SECCOMP_TSYNC": { "alert_emails": ["gcp@mozilla.com"], "bug_numbers": [1098428], "expires_in_version": "55", - "kind": "flag", + "kind": "boolean", "cpp_guard": "XP_LINUX", "description": "Whether the system has seccomp-bpf thread-sync capability" }, - "SANDBOX_CAPABILITIES_USER_NAMESPACES": { + "SANDBOX_HAS_USER_NAMESPACES": { "alert_emails": ["gcp@mozilla.com"], "bug_numbers": [1098428], "expires_in_version": "55", - "kind": "flag", + "kind": "boolean", "cpp_guard": "XP_LINUX", "description": "Whether our process succedeed in creating a user namespace" }, - "SANDBOX_CAPABILITIES_USER_NAMESPACES_PRIVILEGED": { + "SANDBOX_HAS_USER_NAMESPACES_PRIVILEGED": { "alert_emails": ["gcp@mozilla.com"], "bug_numbers": [1098428], "expires_in_version": "55", - "kind": "flag", + "kind": "boolean", "cpp_guard": "XP_LINUX", "description": "Whether the system has the capability to create privileged user namespaces" }, - "SANDBOX_CAPABILITIES_ENABLED_MEDIA": { + "SANDBOX_MEDIA_ENABLED": { "alert_emails": ["gcp@mozilla.com"], "bug_numbers": [1098428], "expires_in_version": "55", - "kind": "flag", + "kind": "boolean", "cpp_guard": "XP_LINUX", "description": "Whether the sandbox is enabled for media/GMP plugins" }, - "SANDBOX_CAPABILITIES_ENABLED_CONTENT": { + "SANDBOX_CONTENT_ENABLED": { "alert_emails": ["gcp@mozilla.com"], "bug_numbers": [1098428], "expires_in_version": "55", - "kind": "flag", + "kind": "boolean", "cpp_guard": "XP_LINUX", "description": "Whether the sandbox is enabled for the content process" },