Bug 1368600 - Add telemetry for when a sandboxed child process fails to start. r=jimm, data-review=francois, a=ritu
authorBob Owen <bobowencode@gmail.com>
Mon, 12 Jun 2017 20:51:02 +0100
changeset 411583 4bd58be05340d9276cb2bff294bd52089c5ff52c
parent 411582 79b23ac343622a80c73cd80ada6d80f3df15a070
child 411584 6190cf16cf233127da389bc6d8aa1d52c29d2dee
push id7398
push userryanvm@gmail.com
push dateMon, 12 Jun 2017 23:25:57 +0000
treeherdermozilla-beta@6190cf16cf23 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, ritu
bugs1368600
milestone55.0
Bug 1368600 - Add telemetry for when a sandboxed child process fails to start. r=jimm, data-review=francois, a=ritu
security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
toolkit/components/telemetry/Histograms.json
--- a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
+++ b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
@@ -7,16 +7,17 @@
 #include "sandboxBroker.h"
 
 #include "base/win/windows_version.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Logging.h"
 #include "mozilla/NSPRLogModulesParser.h"
 #include "mozilla/UniquePtr.h"
+#include "mozilla/Telemetry.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsCOMPtr.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIFile.h"
 #include "nsIProperties.h"
 #include "nsServiceManagerUtils.h"
 #include "nsString.h"
 #include "sandbox/win/src/sandbox.h"
@@ -170,16 +171,17 @@ SandboxBroker::LaunchApp(const wchar_t *
   // Ceate the sandboxed process
   PROCESS_INFORMATION targetInfo = {0};
   sandbox::ResultCode result;
   sandbox::ResultCode last_warning = sandbox::SBOX_ALL_OK;
   DWORD last_error = ERROR_SUCCESS;
   result = sBrokerService->SpawnTarget(aPath, aArguments, mPolicy,
                                        &last_warning, &last_error, &targetInfo);
   if (sandbox::SBOX_ALL_OK != result) {
+    Telemetry::Accumulate(Telemetry::SANDBOX_FAILED_LAUNCH, result);
     LOG_E("Failed (ResultCode %d) to SpawnTarget with last_error=%d, last_warning=%d",
           result, last_error, last_warning);
     return false;
   } else if (sandbox::SBOX_ALL_OK != last_warning) {
     // If there was a warning (but the result was still ok), log it and proceed.
     LOG_W("Warning on SpawnTarget with last_error=%d, last_warning=%d",
           last_error, last_warning);
   }
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -12475,16 +12475,26 @@
     "bug_numbers": [1286865],
     "expires_in_version": "never",
     "releaseChannelCollection": "opt-out",
     "kind": "count",
     "keyed": true,
     "cpp_guard": "XP_LINUX",
     "description": "System calls blocked by a seccomp-bpf sandbox policy; limited to syscalls where we would crash on Nightly.  The key is generally the architecture and syscall ID but in some cases we include non-personally-identifying information from the syscall arguments; see the function SubmitToTelemetry in security/sandbox/linux/reporter/SandboxReporter.cpp for details."
   },
+  "SANDBOX_FAILED_LAUNCH": {
+    "record_in_processes": ["main"],
+    "alert_emails": ["bowen@mozilla.com"],
+    "expires_in_version": "60",
+    "kind": "enumerated",
+    "n_values": 50,
+    "bug_numbers": [1368600],
+    "cpp_guard": "XP_WIN",
+    "description": "Error code when a Windows sandboxed process fails to launch."
+  },
   "SYNC_WORKER_OPERATION": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["amarchesini@mozilla.com", "khuey@mozilla.com" ],
     "bug_numbers": [1267904],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 5000,
     "n_buckets": 20,