#include "memtag.h"
#include "tests/scudo_unit_test.h"
#if SCUDO_ANDROID
#define DEALLOC_TYPE_MISMATCH "false"
#else
#define DEALLOC_TYPE_MISMATCH "true"
#endif
static void EnableMemoryTaggingIfSupported() {
if (!scudo::archSupportsMemoryTagging())
return;
static bool Done = []() {
if (!scudo::systemDetectsMemoryTagFaultsTestOnly())
scudo::enableSystemMemoryTaggingTestOnly();
return true;
}();
(void)Done;
}
bool UseQuarantine = true;
extern "C" __attribute__((visibility("default"))) const char *
__scudo_default_options() {
EnableMemoryTaggingIfSupported();
if (!UseQuarantine)
return "dealloc_type_mismatch=" DEALLOC_TYPE_MISMATCH;
return "quarantine_size_kb=256:thread_local_quarantine_size_kb=128:"
"quarantine_max_chunk_size=512:"
"dealloc_type_mismatch=" DEALLOC_TYPE_MISMATCH;
}
#if !defined(SCUDO_NO_TEST_MAIN)
int main(int argc, char **argv) {
EnableMemoryTaggingIfSupported();
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
#endif