Bug 1603714: Add temporary, Nightly-only crash annotations to UntrustedModulesData and dependencies to determine failure location; r=handyman

Differential Revision: https://phabricator.services.mozilla.com/D57558

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Aaron Klotz 2019-12-18 15:23:02 +00:00
Родитель 97241c909e
Коммит 0b62b4b5ac
4 изменённых файлов: 102 добавлений и 0 удалений

Просмотреть файл

@ -67,6 +67,18 @@ JSObject* CreateJSStackObject(JSContext* cx, const CombinedStacks& stacks);
namespace IPC {
#if defined(NIGHTLY_BUILD)
# define ANNOTATE_READ_FAILURE() \
CrashReporter::AnnotateCrashReport( \
CrashReporter::Annotation:: \
UntrustedModulesDataCombinedStackReadFailure, \
__LINE__)
#else
# define ANNOTATE_READ_FAILURE() \
do { \
} while (false)
#endif // defined(NIGHTLY_BUILD)
template <>
struct ParamTraits<mozilla::Telemetry::CombinedStacks> {
typedef mozilla::Telemetry::CombinedStacks paramType;
@ -81,18 +93,22 @@ struct ParamTraits<mozilla::Telemetry::CombinedStacks> {
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
if (!ReadParam(aMsg, aIter, &aResult->mModules)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mStacks)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mNextIndex)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mMaxStacksCount)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -100,6 +116,8 @@ struct ParamTraits<mozilla::Telemetry::CombinedStacks> {
}
};
#undef ANNOTATE_READ_FAILURE
} // namespace IPC
#endif // CombinedStacks_h__

Просмотреть файл

@ -11,6 +11,7 @@
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/Vector.h"
#include "nsExceptionHandler.h"
#include "nsString.h"
#if defined(MOZ_GECKO_PROFILER)
# include "shared-libraries.h"
@ -87,6 +88,18 @@ class BatchProcessedStackGenerator {
namespace IPC {
#if defined(NIGHTLY_BUILD)
# define ANNOTATE_READ_FAILURE() \
CrashReporter::AnnotateCrashReport( \
CrashReporter::Annotation:: \
UntrustedModulesDataProcessedStackReadFailure, \
__LINE__)
#else
# define ANNOTATE_READ_FAILURE() \
do { \
} while (false)
#endif // defined(NIGHTLY_BUILD)
template <>
struct ParamTraits<mozilla::Telemetry::ProcessedStack::Module> {
typedef mozilla::Telemetry::ProcessedStack::Module paramType;
@ -99,10 +112,12 @@ struct ParamTraits<mozilla::Telemetry::ProcessedStack::Module> {
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
if (!ReadParam(aMsg, aIter, &aResult->mName)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mBreakpadId)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -122,10 +137,12 @@ struct ParamTraits<mozilla::Telemetry::ProcessedStack::Frame> {
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
if (!ReadParam(aMsg, aIter, &aResult->mOffset)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mModIndex)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -133,6 +150,8 @@ struct ParamTraits<mozilla::Telemetry::ProcessedStack::Frame> {
}
};
#undef ANNOTATE_READ_FAILURE
} // namespace IPC
#endif // ProcessedStack_h__

Просмотреть файл

@ -883,6 +883,21 @@ UnmarshalActCtxManifestPath:
Proxy stream unmarshalling current activation context manifest path.
type: string
UntrustedModulesDataCombinedStackReadFailure:
description: >
Location of failure reading UntrustedModulesData combined stack info over IPC
type: integer
UntrustedModulesDataProcessedStackReadFailure:
description: >
Location of failure reading UntrustedModulesData processed stack info over IPC
type: integer
UntrustedModulesDataReadFailure:
description: >
Location of failure reading UntrustedModulesData over IPC
type: integer
UptimeTS:
description: >
Uptime in seconds. This annotation uses a string instead of an integer

Просмотреть файл

@ -20,6 +20,7 @@
# include "mozilla/Vector.h"
# include "mozilla/WinHeaderOnlyUtils.h"
# include "nsCOMPtr.h"
# include "nsExceptionHandler.h"
# include "nsHashKeys.h"
# include "nsIFile.h"
# include "nsISupportsImpl.h"
@ -218,6 +219,17 @@ class ModulesMapResult final {
namespace IPC {
# if defined(NIGHTLY_BUILD)
# define ANNOTATE_READ_FAILURE() \
CrashReporter::AnnotateCrashReport( \
CrashReporter::Annotation::UntrustedModulesDataReadFailure, \
__LINE__)
# else
# define ANNOTATE_READ_FAILURE() \
do { \
} while (false)
# endif // defined(NIGHTLY_BUILD)
template <>
struct ParamTraits<mozilla::ModuleVersion> {
typedef mozilla::ModuleVersion paramType;
@ -230,6 +242,7 @@ struct ParamTraits<mozilla::ModuleVersion> {
paramType* aResult) {
uint64_t ver;
if (!aMsg->ReadUInt64(aIter, &ver)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -251,12 +264,14 @@ struct ParamTraits<mozilla::VendorInfo> {
paramType* aResult) {
uint32_t source;
if (!aMsg->ReadUInt32(aIter, &source)) {
ANNOTATE_READ_FAILURE();
return false;
}
aResult->mSource = static_cast<mozilla::VendorInfo::Source>(source);
if (!ReadParam(aMsg, aIter, &aResult->mVendor)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -293,6 +308,7 @@ struct ParamTraits<mozilla::ModuleRecord> {
nsAutoString resolvedDosName;
if (!ReadParam(aMsg, aIter, &resolvedDosName)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -301,23 +317,28 @@ struct ParamTraits<mozilla::ModuleRecord> {
} else if (NS_FAILED(NS_NewLocalFile(
resolvedDosName, false,
getter_AddRefs(aResult->mResolvedDosName)))) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mSanitizedDllName)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mVersion)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mVendorInfo)) {
ANNOTATE_READ_FAILURE();
return false;
}
uint32_t trustFlags;
if (!aMsg->ReadUInt32(aIter, &trustFlags)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -344,17 +365,20 @@ struct ParamTraits<mozilla::ModulesMap> {
paramType* aResult) {
uint32_t count;
if (!ReadParam(aMsg, aIter, &count)) {
ANNOTATE_READ_FAILURE();
return false;
}
for (uint32_t current = 0; current < count; ++current) {
nsAutoString key;
if (!ReadParam(aMsg, aIter, &key) || key.IsEmpty()) {
ANNOTATE_READ_FAILURE();
return false;
}
RefPtr<mozilla::ModuleRecord> rec(new mozilla::ModuleRecord());
if (!ReadParam(aMsg, aIter, rec.get())) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -379,6 +403,7 @@ struct ParamTraits<mozilla::ModulePaths> {
paramType* aResult) {
uint32_t len;
if (!aMsg->ReadUInt32(aIter, &len)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -386,16 +411,19 @@ struct ParamTraits<mozilla::ModulePaths> {
// Vector representation.
auto& vec = aResult->mModuleNtPaths.as<paramType::VecType>();
if (!vec.reserve(len)) {
ANNOTATE_READ_FAILURE();
return false;
}
for (uint32_t idx = 0; idx < len; ++idx) {
nsString str;
if (!ReadParam(aMsg, aIter, &str)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!vec.emplaceBack(std::move(str))) {
ANNOTATE_READ_FAILURE();
return false;
}
}
@ -446,30 +474,36 @@ struct ParamTraits<mozilla::UntrustedModulesData> {
paramType* aResult) {
uint32_t processType;
if (!aMsg->ReadUInt32(aIter, &processType)) {
ANNOTATE_READ_FAILURE();
return false;
}
aResult->mProcessType = static_cast<GeckoProcessType>(processType);
if (!aMsg->ReadULong(aIter, &aResult->mPid)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mElapsed)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mModules)) {
ANNOTATE_READ_FAILURE();
return false;
}
// We read mEvents manually so that we can use ReadEvent defined below.
uint32_t eventsLen;
if (!ReadParam(aMsg, aIter, &eventsLen)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!aResult->mEvents.resize(eventsLen)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -481,18 +515,22 @@ struct ParamTraits<mozilla::UntrustedModulesData> {
}
if (!ReadParam(aMsg, aIter, &aResult->mStacks)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mXULLoadDurationMS)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!aMsg->ReadUInt32(aIter, &aResult->mSanitizationFailures)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!aMsg->ReadUInt32(aIter, &aResult->mTrustTestFailures)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -525,36 +563,44 @@ struct ParamTraits<mozilla::UntrustedModulesData> {
mozilla::ProcessedModuleLoadEvent* aResult,
const mozilla::ModulesMap& aModulesMap) {
if (!aMsg->ReadUInt64(aIter, &aResult->mProcessUptimeMS)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mLoadDurationMS)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!aMsg->ReadULong(aIter, &aResult->mThreadId)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mThreadName)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mRequestedDllName)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!ReadParam(aMsg, aIter, &aResult->mBaseAddress)) {
ANNOTATE_READ_FAILURE();
return false;
}
nsAutoString resolvedNtName;
if (!ReadParam(aMsg, aIter, &resolvedNtName)) {
ANNOTATE_READ_FAILURE();
return false;
}
aResult->mModule = aModulesMap.Get(resolvedNtName);
if (!aResult->mModule) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -574,10 +620,12 @@ struct ParamTraits<mozilla::ModulesMapResult> {
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
if (!ReadParam(aMsg, aIter, &aResult->mModules)) {
ANNOTATE_READ_FAILURE();
return false;
}
if (!aMsg->ReadUInt32(aIter, &aResult->mTrustTestFailures)) {
ANNOTATE_READ_FAILURE();
return false;
}
@ -585,6 +633,8 @@ struct ParamTraits<mozilla::ModulesMapResult> {
}
};
# undef ANNOTATE_READ_FAILURE
} // namespace IPC
#else // defined(XP_WIN)