if (fault->exec_fault)
fault->prot |= KVM_PGTABLE_PROT_X;
- if (fault->s2_force_noncacheable) {
- if (fault->vm_flags & VM_ALLOW_ANY_UNCACHED)
- fault->prot |= KVM_PGTABLE_PROT_NORMAL_NC;
- else
- fault->prot |= KVM_PGTABLE_PROT_DEVICE;
- } else if (cpus_have_final_cap(ARM64_HAS_CACHE_DIC)) {
+ if (fault->s2_force_noncacheable)
+ fault->prot |= (fault->vm_flags & VM_ALLOW_ANY_UNCACHED) ?
+ KVM_PGTABLE_PROT_NORMAL_NC : KVM_PGTABLE_PROT_DEVICE;
+ else if (cpus_have_final_cap(ARM64_HAS_CACHE_DIC))
fault->prot |= KVM_PGTABLE_PROT_X;
- }
if (fault->nested)
adjust_nested_exec_perms(kvm, fault->nested, &fault->prot);
+ if (!fault->fault_is_perm && !fault->s2_force_noncacheable && kvm_has_mte(kvm)) {
+ /* Check the VMM hasn't introduced a new disallowed VMA */
+ if (!fault->mte_allowed)
+ return -EFAULT;
+ }
+
return 0;
}
}
}
- if (!fault->fault_is_perm && !fault->s2_force_noncacheable && kvm_has_mte(kvm)) {
- /* Check the VMM hasn't introduced a new disallowed VMA */
- if (fault->mte_allowed) {
- sanitise_mte_tags(kvm, fault->pfn, fault->vma_pagesize);
- } else {
- ret = -EFAULT;
- goto out_unlock;
- }
- }
+ if (!fault->fault_is_perm && !fault->s2_force_noncacheable && kvm_has_mte(kvm))
+ sanitise_mte_tags(kvm, fault->pfn, fault->vma_pagesize);
/*
* Under the premise of getting a FSC_PERM fault, we just need to relax