Bug 1266440 - Remove diagnostic funciton mozilla::ipc::AnnotateProcessInformation() that contains PII. r?gabor draft
authorCervantes Yu <cyu@mozilla.com>
Tue, 21 Jun 2016 18:11:22 +0800
changeset 394210 2cf6847e9c97e7eed3e6b2bd2f1b4a442ab4c7c0
parent 394055 ddeb0295df692695b36295177d6790e5393e1f9a
child 526762 a4964e6b987d55e9eda310f6cf8c0e2620c84b90
push id24520
push usercyu@mozilla.com
push dateFri, 29 Jul 2016 08:33:03 +0000
reviewersgabor
bugs1266440
milestone50.0a1
Bug 1266440 - Remove diagnostic funciton mozilla::ipc::AnnotateProcessInformation() that contains PII. r?gabor MozReview-Commit-ID: AJyNT68zJlF
ipc/glue/ProtocolUtils.cpp
ipc/glue/ProtocolUtils.h
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -340,94 +340,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
@@ -434,20 +434,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;