mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Backed out changeset 2540a369a5a8 (bug 1605478) on toshi's request CLOSED TREE
--HG-- extra : rebase_source : c966107f4111d5966e69f41890e466a46685929d extra : histedit_source : 6e48eed0924ed3d3c1c4a5c08ec2a6456d023b31
This commit is contained in:
parent
2beea96feb
commit
c5c8ac7b48
@ -13,7 +13,6 @@
|
||||
#include "mozilla/FileUtilsWin.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/RandomNum.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/WinDllServices.h"
|
||||
@ -302,37 +301,6 @@ bool ProcessedModuleLoadEvent::IsTrusted() const {
|
||||
return mModule->IsTrusted();
|
||||
}
|
||||
|
||||
void UntrustedModulesData::VerifyConsistency() const {
|
||||
#ifdef NIGHTLY_BUILD
|
||||
if (!mIsDiagnosticsAssertEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& evt : mEvents) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(evt.mModule, "Empty module");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!evt.mModule->mResolvedNtName.IsEmpty(),
|
||||
"Empty mResolvedNtName");
|
||||
MOZ_DIAGNOSTIC_ASSERT(mModules.Get(evt.mModule->mResolvedNtName, nullptr),
|
||||
"No match in the table");
|
||||
}
|
||||
#endif // NIGHTLY_BUILD
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool UntrustedModulesData::IsDiagnosticsAssertEnabled() {
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// Trigger MOZ_DIAGNOSTIC_ASSERT with a probability of 1/16
|
||||
constexpr double kDiagnosticsAssertRatio = 0.0625;
|
||||
|
||||
constexpr uint64_t kBoundary =
|
||||
std::numeric_limits<uint64_t>::max() * kDiagnosticsAssertRatio;
|
||||
Maybe<uint64_t> randomNum = RandomUint64();
|
||||
return randomNum.isSome() && randomNum.value() <= kBoundary;
|
||||
#else
|
||||
return false;
|
||||
#endif // NIGHTLY_BUILD
|
||||
}
|
||||
|
||||
void UntrustedModulesData::AddNewLoads(
|
||||
const ModulesMap& aModules, Vector<ProcessedModuleLoadEvent>&& aEvents,
|
||||
Vector<Telemetry::ProcessedStack>&& aStacks) {
|
||||
@ -351,9 +319,6 @@ void UntrustedModulesData::AddNewLoads(
|
||||
}
|
||||
|
||||
RefPtr<ModuleRecord> rec(iter.Data());
|
||||
if (mIsDiagnosticsAssertEnabled) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(rec->mResolvedNtName == iter.Key());
|
||||
}
|
||||
addPtr.OrInsert([rec = std::move(rec)]() { return rec; });
|
||||
}
|
||||
|
||||
|
@ -171,8 +171,7 @@ class UntrustedModulesData final {
|
||||
: mProcessType(XRE_GetProcessType()),
|
||||
mPid(::GetCurrentProcessId()),
|
||||
mSanitizationFailures(0),
|
||||
mTrustTestFailures(0),
|
||||
mIsDiagnosticsAssertEnabled(IsDiagnosticsAssertEnabled()) {}
|
||||
mTrustTestFailures(0) {}
|
||||
|
||||
UntrustedModulesData(UntrustedModulesData&&) = default;
|
||||
UntrustedModulesData& operator=(UntrustedModulesData&&) = default;
|
||||
@ -191,9 +190,6 @@ class UntrustedModulesData final {
|
||||
|
||||
void Swap(UntrustedModulesData& aOther);
|
||||
|
||||
void VerifyConsistency() const;
|
||||
static bool IsDiagnosticsAssertEnabled();
|
||||
|
||||
GeckoProcessType mProcessType;
|
||||
DWORD mPid;
|
||||
TimeDuration mElapsed;
|
||||
@ -203,10 +199,6 @@ class UntrustedModulesData final {
|
||||
Maybe<double> mXULLoadDurationMS;
|
||||
uint32_t mSanitizationFailures;
|
||||
uint32_t mTrustTestFailures;
|
||||
|
||||
// This is not serialized.
|
||||
// Cannot be const as we have the default move ctor.
|
||||
bool mIsDiagnosticsAssertEnabled;
|
||||
};
|
||||
|
||||
class ModulesMapResult final {
|
||||
@ -434,8 +426,6 @@ struct ParamTraits<mozilla::UntrustedModulesData> {
|
||||
typedef mozilla::UntrustedModulesData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aParam.VerifyConsistency();
|
||||
|
||||
aMsg->WriteUInt32(aParam.mProcessType);
|
||||
aMsg->WriteULong(aParam.mPid);
|
||||
WriteParam(aMsg, aParam.mElapsed);
|
||||
@ -485,7 +475,7 @@ struct ParamTraits<mozilla::UntrustedModulesData> {
|
||||
|
||||
for (uint32_t curEventIdx = 0; curEventIdx < eventsLen; ++curEventIdx) {
|
||||
if (!ReadEvent(aMsg, aIter, &(aResult->mEvents[curEventIdx]),
|
||||
aResult->mModules, aResult->mIsDiagnosticsAssertEnabled)) {
|
||||
aResult->mModules)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -533,8 +523,7 @@ struct ParamTraits<mozilla::UntrustedModulesData> {
|
||||
// specialization.
|
||||
static bool ReadEvent(const Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::ProcessedModuleLoadEvent* aResult,
|
||||
const mozilla::ModulesMap& aModulesMap,
|
||||
bool aIsDiagnosticsAssertEnabled) {
|
||||
const mozilla::ModulesMap& aModulesMap) {
|
||||
if (!aMsg->ReadUInt64(aIter, &aResult->mProcessUptimeMS)) {
|
||||
return false;
|
||||
}
|
||||
@ -569,11 +558,6 @@ struct ParamTraits<mozilla::UntrustedModulesData> {
|
||||
// rather than an IPC error. The error is detected and dealt with in
|
||||
// telemetry.
|
||||
aResult->mModule = aModulesMap.Get(resolvedNtName);
|
||||
if (!aResult->mModule && aIsDiagnosticsAssertEnabled) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aModulesMap.Count() > 0, "Empty module list");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!resolvedNtName.IsEmpty(), "Empty resolvedNtName");
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "Something else");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -381,8 +381,6 @@ RefPtr<UntrustedModulesPromise> UntrustedModulesProcessor::GetAllProcessedData(
|
||||
|
||||
result.mElapsed = TimeStamp::Now() - TimeStamp::ProcessCreation();
|
||||
|
||||
result.VerifyConsistency();
|
||||
|
||||
return UntrustedModulesPromise::CreateAndResolve(
|
||||
Some(UntrustedModulesData(std::move(result))), aSource);
|
||||
}
|
||||
@ -877,12 +875,6 @@ void UntrustedModulesProcessor::CompleteProcessing(
|
||||
return;
|
||||
}
|
||||
|
||||
// Trusted modules should have been eliminated by GetModulesTrustInternal
|
||||
// in the browser process
|
||||
if (mProcessedModuleLoads.mIsDiagnosticsAssertEnabled) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!event.IsTrusted());
|
||||
}
|
||||
|
||||
Telemetry::ProcessedStack processedStack =
|
||||
stackProcessor.GetStackAndModules(backtrace);
|
||||
|
||||
@ -903,9 +895,6 @@ void UntrustedModulesProcessor::CompleteProcessing(
|
||||
|
||||
mProcessedModuleLoads.AddNewLoads(modules, std::move(processedEvents),
|
||||
std::move(processedStacks));
|
||||
|
||||
mProcessedModuleLoads.VerifyConsistency();
|
||||
|
||||
if (maybeXulLoadDuration) {
|
||||
MOZ_ASSERT(!mProcessedModuleLoads.mXULLoadDurationMS);
|
||||
mProcessedModuleLoads.mXULLoadDurationMS = maybeXulLoadDuration;
|
||||
|
Loading…
x
Reference in New Issue
Block a user