AArch64 EL2 hypervisor for QEMU virt that boots at EL2
1

Configure Feed

Select the types of activity you want to include in your feed.

Constrain register emulation with explicit architectural masks

+11 -2
+11 -2
core/policy.c
··· 100 100 return true; 101 101 } 102 102 103 + static uint64_t policy_mask_value(const struct policy_entry *entry, uint64_t current, uint64_t operand) 104 + { 105 + uint64_t preserve = current & ~entry->writable_mask; 106 + if (preserve == 0u) { 107 + preserve = entry->reset_value & ~entry->writable_mask; 108 + } 109 + return preserve | (operand & entry->writable_mask); 110 + } 111 + 103 112 void policy_init(void) 104 113 { 105 114 g_profile = POLICY_PROFILE_STRICT; ··· 259 268 decision->action = POLICY_DENY_UNDEF; 260 269 return true; 261 270 } 262 - *slot = operand & entry->writable_mask; 271 + *slot = policy_mask_value(entry, *slot, operand); 263 272 decision->value = *slot; 264 273 if (g_profile == POLICY_PROFILE_LINUX_BOOT && is_el1_mmu_key(access->key)) { 265 274 arch_sync_el1_sysregs(vcpu); ··· 271 280 decision->action = POLICY_DENY_UNDEF; 272 281 return true; 273 282 } 274 - *slot = (*slot & ~entry->writable_mask) | (operand & entry->writable_mask); 283 + *slot = policy_mask_value(entry, *slot, operand); 275 284 decision->value = *slot; 276 285 if (g_profile == POLICY_PROFILE_LINUX_BOOT && is_el1_mmu_key(access->key)) { 277 286 arch_sync_el1_sysregs(vcpu);