Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42a3f876 authored by Ryan Prichard's avatar Ryan Prichard
Browse files

trusty: clear fuzzer's extra counters directly

The FuzzerDefs.h APIs are internal to the fuzzer and aren't available
when the fuzzer is built with a custom private libc++, so remove the
ExtraCountersBegin/ExtraCountersEnd assertions and inline the array
clearing.

Bug: 175635923
Bug: 303175229
Bug: 315079422
Test: m libtrusty_fuzz_utils trusty_gatekeeper_fuzzer
Change-Id: I1ca9d9867026ff6f8e494ac6026fb1314caab7d1
parent 6b241447
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -41,9 +41,6 @@ cc_library {
        "utils.cpp",
    ],
    export_include_dirs: ["include"],
    static_libs: [
        "libFuzzer",
    ],
    shared_libs: [
        "libtrusty_coverage",
        "libbase",
+3 −7
Original line number Diff line number Diff line
@@ -16,12 +16,12 @@

#define LOG_TAG "trusty-fuzz-counters"

#include <FuzzerDefs.h>

#include <trusty/fuzz/counters.h>

#include <android-base/logging.h>
#include <assert.h>
#include <log/log.h>
#include <string.h>
#include <trusty/coverage/coverage.h>
#include <trusty/coverage/tipc.h>

@@ -45,9 +45,6 @@ ExtraCounters::ExtraCounters(coverage::CoverageRecord* record) : record_(record)
        return;
    }

    assert(fuzzer::ExtraCountersBegin());
    assert(fuzzer::ExtraCountersEnd());

    volatile uint8_t* begin = NULL;
    volatile uint8_t* end = NULL;
    record_->GetRawCounts(&begin, &end);
@@ -66,9 +63,8 @@ void ExtraCounters::Reset() {
    if (!record_->IsOpen()) {
        return;
    }

    record_->ResetCounts();
    fuzzer::ClearExtraCounters();
    memset_explicit(const_cast<uint8_t*>(counters), 0, sizeof(counters));
}

void ExtraCounters::Flush() {