|
1 | 1 | // Copyright Microsoft and CHERIoT Contributors. |
2 | 2 | // SPDX-License-Identifier: MIT |
3 | 3 |
|
| 4 | +#include "token.h" |
4 | 5 | #define TEST_NAME "ISA" |
5 | 6 | #include "tests.hh" |
6 | 7 | #include <debug.hh> |
@@ -214,18 +215,18 @@ namespace |
214 | 215 | const Capability CapabilityToGlobal{myGlobalIntPointer}; |
215 | 216 | const Capability CapabilityToFunction{ |
216 | 217 | reinterpret_cast<const void *>(&test_and_perms)}; |
| 218 | + const Capability SealingCapability{token_key_new()}; |
217 | 219 | 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++) |
224 | 224 | { |
225 | 225 | auto permissionMask = PermissionSet::from_raw(p); |
226 | 226 | test_restrict_capability(CapabilityToLocal, permissionMask); |
227 | 227 | test_restrict_capability(CapabilityToGlobal, permissionMask); |
228 | 228 | test_restrict_capability(CapabilityToFunction, permissionMask); |
| 229 | + test_restrict_capability(SealingCapability, permissionMask); |
229 | 230 | } |
230 | 231 | } |
231 | 232 |
|
|
0 commit comments