summaryrefslogtreecommitdiffstats
path: root/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp')
-rw-r--r--toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp43
1 files changed, 19 insertions, 24 deletions
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<DWORD, const char*>* 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
// ============================================================================