Only use InProcess backend in fuzzer
This is a partial revert of 7e6446c3da42("Refactored
surfaceflinger_frametracer_fuzzer").
I think the intent of the fuzzer is more to stress the surface flinger
tracing code and less to stress the perfetto consumer code (which is
less security critical).
kUnspecifiedBackend is equivalent to kInProcessBackend (it's the first
registered backend which we initialized earlier with
perfetto::Tracing::Initialize()). kCustomBackend will not have any
effect, because no custom backend has been previously registered.
kSystemBackend will make the producer talk with the real perfetto
tracing service on the system: this doesn't have much value because the
real code is not running under the fuzzer there. The only code under the
fuzzer will be the consumer part of the perfetto C++ SDK, which is not
security critical.
This makes the fuzzer run much faster.
Bug: 307601836
Change-Id: Ia5c4b42bf4916783d7eafa7b51b97ee6a7fc726e
diff --git a/services/surfaceflinger/fuzzer/surfaceflinger_frametracer_fuzzer.cpp b/services/surfaceflinger/fuzzer/surfaceflinger_frametracer_fuzzer.cpp
index fa2ab58..ce8d47e 100644
--- a/services/surfaceflinger/fuzzer/surfaceflinger_frametracer_fuzzer.cpp
+++ b/services/surfaceflinger/fuzzer/surfaceflinger_frametracer_fuzzer.cpp
@@ -30,12 +30,6 @@
constexpr int32_t kConfigDuration = 500;
constexpr int32_t kBufferSize = 1024;
constexpr int32_t kTimeOffset = 100000;
-constexpr perfetto::BackendType backendTypes[] = {
- perfetto::kUnspecifiedBackend,
- perfetto::kInProcessBackend,
- perfetto::kSystemBackend,
- perfetto::kCustomBackend,
-};
class FrameTracerFuzzer {
public:
@@ -71,8 +65,7 @@
auto* dsCfg = cfg.add_data_sources()->mutable_config();
dsCfg->set_name(android::FrameTracer::kFrameTracerDataSource);
- auto tracingSession =
- perfetto::Tracing::NewTrace(mFdp.PickValueInArray<perfetto::BackendType>(backendTypes));
+ auto tracingSession = perfetto::Tracing::NewTrace(perfetto::kInProcessBackend);
tracingSession->Setup(cfg);
return tracingSession;
}