commit 0c3292bc0b6e9fa9db6a0042c373a7133b222516
parent 21772e58f30fa27a5b9f4958505d7ace99d30088
Author: Christian Holler (:decoder) <choller@mozilla.com>
Date: Wed, 22 Oct 2025 12:42:24 +0000
Bug 1994789 - Use OnActorConnected/Destroyed only when an IPC fuzzing target is active. r=truber
Differential Revision: https://phabricator.services.mozilla.com/D268922
Diffstat:
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/tools/fuzzing/ipc/IPCFuzzController.cpp b/tools/fuzzing/ipc/IPCFuzzController.cpp
@@ -296,7 +296,8 @@ static bool IsManagedByTargetActor(IProtocol* protocol,
}
void IPCFuzzController::OnActorConnected(IProtocol* protocol) {
- if (!XRE_IsParentProcess()) {
+ if (!XRE_IsParentProcess() ||
+ !mozilla::fuzzing::Nyx::instance().is_enabled("IPC_", true)) {
return;
}
@@ -393,7 +394,8 @@ void IPCFuzzController::OnActorConnected(IProtocol* protocol) {
}
void IPCFuzzController::OnActorDestroyed(IProtocol* protocol) {
- if (!XRE_IsParentProcess()) {
+ if (!XRE_IsParentProcess() ||
+ !mozilla::fuzzing::Nyx::instance().is_enabled("IPC_", true)) {
return;
}
diff --git a/tools/fuzzing/nyx/Nyx.cpp b/tools/fuzzing/nyx/Nyx.cpp
@@ -140,9 +140,10 @@ void Nyx::start(void) {
bool Nyx::started(void) { return mInited; }
-bool Nyx::is_enabled(const char* identifier) {
+bool Nyx::is_enabled(const char* identifier, bool startswith) {
static char* fuzzer = getenv("NYX_FUZZER");
- if (!fuzzer || strcmp(fuzzer, identifier)) {
+ if (!fuzzer || (!startswith && strcmp(fuzzer, identifier)) ||
+ (startswith && strncmp(fuzzer, identifier, strlen(identifier)))) {
return false;
}
return true;
diff --git a/tools/fuzzing/nyx/Nyx.h b/tools/fuzzing/nyx/Nyx.h
@@ -31,7 +31,7 @@ class Nyx {
void start(void);
bool started(void);
- bool is_enabled(const char* identifier);
+ bool is_enabled(const char* identifier, bool startswith = false);
bool is_replay();
uint32_t get_data(uint8_t* data, uint32_t size);
uint32_t get_raw_data(uint8_t* data, uint32_t size);