From 9905ad2cad605f27b094d0c31081626e4bdd0387 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Mon, 15 Mar 2021 23:28:19 -0700 Subject: [PATCH] trusty: fuzz: Poke the port of lazy-loaded TAs to load them. We need to do this to make sure that target TA is connected to coverage service. Bug: 171750250 Test: trusty_test_fuzzer Change-Id: I207b8c674a0c5630dd6baf966d3dfb243a855be0 --- trusty/fuzz/tipc_fuzzer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/trusty/fuzz/tipc_fuzzer.cpp b/trusty/fuzz/tipc_fuzzer.cpp index 24b0f98d2..325894470 100644 --- a/trusty/fuzz/tipc_fuzzer.cpp +++ b/trusty/fuzz/tipc_fuzzer.cpp @@ -51,13 +51,21 @@ extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) { exit(-1); } + /* Make sure lazy-loaded TAs have started and connected to coverage service. */ + TrustyApp ta(TIPC_DEV, TRUSTY_APP_PORT); + auto ret = ta.Connect(); + if (!ret.ok()) { + std::cerr << ret.error() << std::endl; + exit(-1); + } + record = std::make_unique(TIPC_DEV, &module_uuid, TRUSTY_APP_FILENAME); if (!record) { std::cerr << "Failed to allocate coverage record" << std::endl; exit(-1); } - auto ret = record->Open(); + ret = record->Open(); if (!ret.ok()) { std::cerr << ret.error() << std::endl; exit(-1);