Extend malloc test to check CHERI capability length.

This commit is contained in:
Robert Norton
2022-02-07 16:36:51 +00:00
committed by Matthew Parkinson
parent 63d3928687
commit 539937336d

View File

@@ -44,6 +44,15 @@ void check_result(size_t size, size_t align, void* p, int err, bool null)
const auto exact_size = false;
#else
const auto exact_size = align == 1;
#endif
#ifdef __CHERI_PURE_CAPABILITY__
const auto cheri_size = __builtin_cheri_length_get(p);
if (cheri_size != alloc_size && (size != 0))
{
printf(
"Cheri size is %zu, but required to be %zu.\n", cheri_size, alloc_size);
failed = true;
}
#endif
if (exact_size && (alloc_size != expected_size) && (size != 0))
{