From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../dllservices/mozglue/WindowsDllBlocklist.cpp | 43 ++++++++++------------ .../xre/dllservices/mozglue/WindowsDllBlocklist.h | 9 +++-- 2 files changed, 25 insertions(+), 27 deletions(-) (limited to 'toolkit/xre/dllservices') diff --git a/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp b/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp index 29745d5af6..4f97ccc39f 100644 --- a/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp +++ b/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp @@ -15,7 +15,6 @@ #include "BaseProfiler.h" #include "nsWindowsDllInterceptor.h" #include "mozilla/CmdLineAndEnvUtils.h" -#include "mozilla/DebugOnly.h" #include "mozilla/StackWalk_windows.h" #include "mozilla/TimeStamp.h" #include "mozilla/UniquePtr.h" @@ -44,9 +43,6 @@ glue::detail::DllServicesBase* gDllServices; using namespace mozilla; -using CrashReporter::Annotation; -using CrashReporter::AnnotationWriter; - #define DLL_BLOCKLIST_ENTRY(name, ...) {name, __VA_ARGS__}, #define DLL_BLOCKLIST_STRING_TYPE const char* #include "mozilla/WindowsDllBlocklistLegacyDefs.h" @@ -54,10 +50,13 @@ using CrashReporter::AnnotationWriter; // define this for very verbose dll load debug spew #undef DEBUG_very_verbose +using WritableBuffer = mozilla::glue::detail::WritableBuffer<1024>; + static uint32_t sInitFlags; static bool sBlocklistInitAttempted; static bool sBlocklistInitFailed; static bool sUser32BeforeBlocklist; +static WritableBuffer sBlocklistWriter; typedef MOZ_NORETURN_PTR void(__fastcall* BaseThreadInitThunk_func)( BOOL aIsInitialThread, void* aStartAddress, void* aThreadParam); @@ -174,8 +173,6 @@ class ReentrancySentinel { std::map* ReentrancySentinel::sThreadMap; -using WritableBuffer = mozilla::glue::detail::WritableBuffer<1024>; - /** * This is a linked list of DLLs that have been blocked. It doesn't use * mozilla::LinkedList because this is an append-only list and doesn't need @@ -673,22 +670,11 @@ MFBT_API void DllBlocklist_Initialize(uint32_t aInitFlags) { MFBT_API void DllBlocklist_Shutdown() {} #endif // DEBUG -static void InternalWriteNotes(AnnotationWriter& aWriter) { - WritableBuffer buffer; - DllBlockSet::Write(buffer); - - aWriter.Write(Annotation::BlockedDllList, buffer.Data(), buffer.Length()); - - if (sBlocklistInitFailed) { - aWriter.Write(Annotation::BlocklistInitFailed, "1"); - } - - if (sUser32BeforeBlocklist) { - aWriter.Write(Annotation::User32BeforeBlocklist, "1"); - } +static void InternalWriteNotes(WritableBuffer& aBuffer) { + DllBlockSet::Write(aBuffer); } -using WriterFn = void (*)(AnnotationWriter&); +using WriterFn = void (*)(WritableBuffer& aBuffer); static WriterFn gWriterFn = &InternalWriteNotes; static void GetNativeNtBlockSetWriter() { @@ -699,16 +685,25 @@ static void GetNativeNtBlockSetWriter() { } } -MFBT_API void DllBlocklist_WriteNotes(AnnotationWriter& aWriter) { - MOZ_ASSERT(gWriterFn); - gWriterFn(aWriter); -} +MFBT_API void DllBlocklist_WriteNotes() { gWriterFn(sBlocklistWriter); } MFBT_API bool DllBlocklist_CheckStatus() { if (sBlocklistInitFailed || sUser32BeforeBlocklist) return false; return true; } +MFBT_API bool* DllBlocklist_GetBlocklistInitFailedPointer() { + return &sBlocklistInitFailed; +} + +MFBT_API bool* DllBlocklist_GetUser32BeforeBlocklistPointer() { + return &sUser32BeforeBlocklist; +} + +MFBT_API const char* DllBlocklist_GetBlocklistWriterData() { + return sBlocklistWriter.Data(); +} + // ============================================================================ // This section is for DLL Services // ============================================================================ diff --git a/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.h b/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.h index 1b43e6d1fc..35408b0269 100644 --- a/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.h +++ b/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.h @@ -10,10 +10,9 @@ (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64)) # include -# include "CrashAnnotations.h" -# include "mozilla/Attributes.h" # include "mozilla/ProcessType.h" # include "mozilla/Types.h" +# include # define HAS_DLL_BLOCKLIST @@ -47,9 +46,13 @@ extern uint32_t gBlocklistInitFlags; MFBT_API void DllBlocklist_Initialize( uint32_t aInitFlags = eDllBlocklistInitFlagDefault); -MFBT_API void DllBlocklist_WriteNotes(CrashReporter::AnnotationWriter& aWriter); +MFBT_API void DllBlocklist_WriteNotes(); MFBT_API bool DllBlocklist_CheckStatus(); +MFBT_API bool* DllBlocklist_GetBlocklistInitFailedPointer(); +MFBT_API bool* DllBlocklist_GetUser32BeforeBlocklistPointer(); +MFBT_API const char* DllBlocklist_GetBlocklistWriterData(); + // This export intends to clean up after DllBlocklist_Initialize(). // It's disabled in release builds for performance and to limit callers' ability // to interfere with dll blocking. -- cgit v1.2.3