Skip to content

Commit 4bf1383

Browse files
committed
ISA Test: use token sealing key to test and perms of sealing capability.
1 parent 3d229fc commit 4bf1383

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/isa-test.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright Microsoft and CHERIoT Contributors.
22
// SPDX-License-Identifier: MIT
33

4+
#include "token.h"
45
#define TEST_NAME "ISA"
56
#include "tests.hh"
67
#include <debug.hh>
@@ -214,18 +215,18 @@ namespace
214215
const Capability CapabilityToGlobal{myGlobalIntPointer};
215216
const Capability CapabilityToFunction{
216217
reinterpret_cast<const void *>(&test_and_perms)};
218+
const Capability SealingCapability{token_key_new()};
217219
debug_log("Checking and perms results...");
218-
// TODO we could do with a sealing capability too, but then this would
219-
// need to become a privileged compartment.
220-
// Test all possible masks on our 'root' capabilities. For now we only
221-
// test permissions on data / executable capabilities. Conveniently
222-
// these occupy the lower 9 bits of the permissions field.
223-
for (uint32_t p = 0; p <= 0x1ff; p++)
220+
// Test all possible masks on our 'root' capabilities. Our sealing
221+
// capability doesn't include the user perm so we exclude that for now
222+
// meaning we only test the low 11 bits of the permissions field.
223+
for (uint32_t p = 0; p <= 0x7ff; p++)
224224
{
225225
auto permissionMask = PermissionSet::from_raw(p);
226226
test_restrict_capability(CapabilityToLocal, permissionMask);
227227
test_restrict_capability(CapabilityToGlobal, permissionMask);
228228
test_restrict_capability(CapabilityToFunction, permissionMask);
229+
test_restrict_capability(SealingCapability, permissionMask);
229230
}
230231
}
231232

0 commit comments

Comments
 (0)