Thread (107 messages) 107 messages, 7 authors, 2022-07-28

Re: [PATCH 59/89] KVM: arm64: Do not support MTE for protected VMs

From: Peter Collingbourne <hidden>
Date: 2022-06-08 17:41:13
Also in: kvm, kvmarm

On Wed, Jun 8, 2022 at 12:40 AM Fuad Tabba [off-list ref] wrote:
Hi Peter,

On Tue, Jun 7, 2022 at 1:42 AM Peter Collingbourne [off-list ref] wrote:
quoted
On Thu, May 19, 2022 at 7:40 AM Will Deacon [off-list ref] wrote:
quoted
From: Fuad Tabba <tabba@google.com>

Return an error (-EINVAL) if trying to enable MTE on a protected
vm.

Signed-off-by: Fuad Tabba <tabba@google.com>
---
 arch/arm64/kvm/arm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 10e036bf06e3..8a1b4ba1dfa7 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -90,7 +90,9 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
                break;
        case KVM_CAP_ARM_MTE:
                mutex_lock(&kvm->lock);
-               if (!system_supports_mte() || kvm->created_vcpus) {
+               if (!system_supports_mte() ||
+                   kvm_vm_is_protected(kvm) ||
Should this check be added to kvm_vm_ioctl_check_extension() as well?
No need. kvm_vm_ioctl_check_extension() calls pkvm_check_extension()
for protected vms, which functions as an allow list rather than a
block list.
I see. I guess I got confused when reading the code because I saw this
in kvm_check_extension():

        case KVM_CAP_ARM_NISV_TO_USER:
                r = !kvm || !kvm_vm_is_protected(kvm);
                break;

This can probably be simplified to "r = 1;".

Peter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help