Bug 1266440 - Remove diagnostic funciton mozilla::ipc::AnnotateProcessInformation() that contains PII. r?gabor
MozReview-Commit-ID: AJyNT68zJlF
--- 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;