Bug 1266440 - Remove diagnostic funciton mozilla::ipc::AnnotateProcessInformation() that contains PII. r=krizsa, a=sylvestre
authorCervantes Yu <cyu@mozilla.com>
Mon, 01 Aug 2016 18:41:09 +0800
changeset 342255 b5ba20fc86c8e75e7f21904f65113a68909839aa
parent 342254 b5f952be46cf4a0513cca678cc12be9eb1643a93
child 342256 7af8faeaf115123fa3774221d930fa80aed1fd49
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskrizsa, sylvestre
bugs1266440
milestone49.0
Bug 1266440 - Remove diagnostic funciton mozilla::ipc::AnnotateProcessInformation() that contains PII. r=krizsa, a=sylvestre MozReview-Commit-ID: AJyNT68zJlF
ipc/glue/ProtocolUtils.cpp
ipc/glue/ProtocolUtils.h
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -334,94 +334,16 @@ AnnotateSystemError()
   error = errno;
 #endif
   if (error) {
     CrashReporter::AnnotateCrashReport(
       NS_LITERAL_CSTRING("IPCSystemError"),
       nsPrintfCString("%lld", error));
   }
 }
-
-void
-AnnotateProcessInformation(base::ProcessId aPid)
-{
-#ifdef XP_WIN
-  ScopedProcessHandle processHandle(
-    OpenProcess(READ_CONTROL|PROCESS_QUERY_INFORMATION, FALSE, aPid));
-  if (!processHandle) {
-    CrashReporter::AnnotateCrashReport(
-      NS_LITERAL_CSTRING("IPCExtraSystemError"),
-      nsPrintfCString("Failed to get information of process %d, error(%d)",
-                      aPid,
-                      ::GetLastError()));
-    return;
-  }
-
-  DWORD exitCode = 0;
-  if (!::GetExitCodeProcess(processHandle, &exitCode)) {
-    CrashReporter::AnnotateCrashReport(
-      NS_LITERAL_CSTRING("IPCExtraSystemError"),
-      nsPrintfCString("Failed to get exit information of process %d, error(%d)",
-                      aPid,
-                      ::GetLastError()));
-    return;
-  }
-
-  if (exitCode != STILL_ACTIVE) {
-    CrashReporter::AnnotateCrashReport(
-      NS_LITERAL_CSTRING("IPCExtraSystemError"),
-      nsPrintfCString("Process %d is not alive. Exit code: %d",
-                      aPid,
-                      exitCode));
-    return;
-  }
-
-  ScopedPSecurityDescriptor secDesc(nullptr);
-  PSID ownerSid = nullptr;
-  DWORD rv = ::GetSecurityInfo(processHandle,
-                               SE_KERNEL_OBJECT,
-                               OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
-                               &ownerSid,
-                               nullptr,
-                               nullptr,
-                               nullptr,
-                               &secDesc.rwget());
-  if (rv != ERROR_SUCCESS) {
-    // GetSecurityInfo() failed.
-    CrashReporter::AnnotateCrashReport(
-      NS_LITERAL_CSTRING("IPCExtraSystemError"),
-      nsPrintfCString("Failed to get security information of process %d,"
-                      " error(%d)",
-                      aPid,
-                      rv));
-    return;
-  }
-
-  ScopedLPTStr ownerSidStr(nullptr);
-  nsString annotation{};
-  annotation.AppendLiteral("Owner: ");
-  if (::ConvertSidToStringSid(ownerSid, &ownerSidStr.rwget())) {
-    annotation.Append(ownerSidStr.get());
-  }
-
-  ScopedLPTStr secDescStr(nullptr);
-  annotation.AppendLiteral(", Security Descriptor: ");
-  if (::ConvertSecurityDescriptorToStringSecurityDescriptor(secDesc,
-                                                            SDDL_REVISION_1,
-                                                            DACL_SECURITY_INFORMATION,
-                                                            &secDescStr.rwget(),
-                                                            nullptr)) {
-    annotation.Append(secDescStr.get());
-  }
-
-  CrashReporter::AnnotateCrashReport(
-    NS_LITERAL_CSTRING("IPCExtraSystemError"),
-    NS_ConvertUTF16toUTF8(annotation));
-#endif
-}
 #endif
 
 void
 LogMessageForProtocol(const char* aTopLevelProtocol, base::ProcessId aOtherPid,
                       const char* aContextDescription,
                       const char* aMessageDescription,
                       MessageDirection aDirection)
 {
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -433,20 +433,18 @@ DuplicateHandle(HANDLE aSourceHandle,
 #endif
 
 /**
  * Annotate the crash reporter with the error code from the most recent system
  * call. Returns the system error.
  */
 #ifdef MOZ_CRASHREPORTER
 void AnnotateSystemError();
-void AnnotateProcessInformation(base::ProcessId aPid);
 #else
 #define AnnotateSystemError() do { } while (0)
-#define AnnotateProcessInformation(...) do { } while (0)
 #endif
 
 /**
  * An endpoint represents one end of a partially initialized IPDL channel. To
  * set up a new top-level protocol:
  *
  * Endpoint<PFooParent> parentEp;
  * Endpoint<PFooChild> childEp;