pagemap: don't depend on SNMALLOC_CHECK_CLIENT

Instead, take a template parameter for the no-args init() method, so
that randomization can be disabled on StrictProvenance architectures
(CHERI), where we don't expect it to be useful, even when snmalloc is
being built to be otherwise paranoid.

Catch callsites up.
This commit is contained in:
Nathaniel Wesley Filardo
2022-12-10 07:53:15 +00:00
committed by Nathaniel Filardo
parent 30da31d245
commit 06873ac366
4 changed files with 51 additions and 28 deletions

View File

@@ -121,7 +121,13 @@ namespace snmalloc
int main()
{
snmalloc::CustomConfig::Pagemap::concretePagemap.init(); // init pagemap
# if defined(SNMALLOC_CHECK_CLIENT)
static constexpr bool pagemap_randomize = !aal_supports<StrictProvenance>;
# else
static constexpr bool pagemap_randomize = false;
# endif
snmalloc::CustomConfig::Pagemap::concretePagemap.init<pagemap_randomize>();
snmalloc::CustomConfig::domesticate_count = 0;
LocalEntropy entropy;

View File

@@ -81,7 +81,13 @@ void test_pagemap(bool bounded)
}
else
{
pagemap_test_unbound.init();
#if defined(SNMALLOC_CHECK_CLIENT)
static constexpr bool pagemap_randomize = !aal_supports<StrictProvenance>;
#else
static constexpr bool pagemap_randomize = false;
#endif
pagemap_test_unbound.init<pagemap_randomize>();
pagemap_test_unbound.register_range(low, high - low);
}