MTE support for KVM guest
v8 cover MTE support for KVM guest
Another round of updates following review comments from Marc (thanks!). This is rather late for v5.12, so I'll rebase again after -rc1 is out.
This series adds support for using the Arm Memory Tagging Extensions (MTE) in a KVM guest.
This version splits the change to the tag synchronisation out to it's own patch (patch 1), and also separates the introduction and exposing of KVM_ARM_CAP_MTE into two patches (2 and 4) to avoid a dependency problem with the save/restore patch (3). As before patch 5 is an RFC for adding a new ioctl for reading/writing tags (I would appreciate feedback!).
Changes since v7[1]:
* Split into hopefully more logic patches.
* Save/restore of TFSRE0_EL1 is now done in C code.
* Make save/restore of TFSR_EL1 conditional on the VM having MTE enabled.
* Replaced register descriptions boilerplate in sys_regs.c with a new MTE_REG() macro.
[1] https://lore.kernel.org/r/20210115152811.8398-1-steven.price%40arm.com
Steven Price (5):
arm64: mte: Sync tags for pages where PTE is untagged
arm64: kvm: Introduce MTE VM feature
arm64: kvm: Save/restore MTE registers
arm64: kvm: Expose KVM_ARM_CAP_MTE
KVM: arm64: ioctl to fetch/store tags in a guest
arch/arm64/include/asm/kvm_emulate.h | 3 + arch/arm64/include/asm/kvm_host.h | 9 +++ arch/arm64/include/asm/kvm_mte.h | 66 ++++++++++++++++++++++ arch/arm64/include/asm/pgtable.h | 2 +- arch/arm64/include/asm/sysreg.h | 3 +- arch/arm64/include/uapi/asm/kvm.h | 13 +++++ arch/arm64/kernel/asm-offsets.c | 3 + arch/arm64/kernel/mte.c | 16 ++++-- arch/arm64/kvm/arm.c | 66 ++++++++++++++++++++++ arch/arm64/kvm/hyp/entry.S | 7 +++ arch/arm64/kvm/hyp/exception.c | 3 +- arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 21 +++++++ arch/arm64/kvm/mmu.c | 16 ++++++ arch/arm64/kvm/sys_regs.c | 28 +++++++-- include/uapi/linux/kvm.h | 2 + 15 files changed, 246 insertions(+), 12 deletions(-) create mode 100644 arch/arm64/include/asm/kvm_mte.h
Signature · 6 lines
2.20.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v8 1/5 arm64: mte: Sync tags for pages where PTE is untagged
A KVM guest could store tags in a page even if the VMM hasn't mapped the page with PROT_MTE. So when restoring pages from swap we will need to check to see if there are any saved tags even if !pte_tagged().
However don't check pages which are !pte_valid_user() as these will not have been swapped out.
--- arch/arm64/include/asm/pgtable.h | 2 +- arch/arm64/kernel/mte.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)
arch/arm64/include/asm/pgtable.h +1 -1
@@ -312,7 +312,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,__sync_icache_dcache (pte);if (system_supports_mte () && -pte_present (pte) &&pte_tagged (pte) && !pte_special (pte)) +pte_present (pte) &&pte_valid_user (pte) && !pte_special (pte))mte_sync_tags (ptep, pte);__check_racy_pte_update (mm, ptep, pte);
arch/arm64/kernel/mte.c +12 -4
@@ -25,17 +25,23 @@u64 gcr_kernel_excl__ro_after_init ; -static void mte_sync_page_tags (struct page *page,pte_t *ptep,bool check_swap) +static void mte_sync_page_tags (struct page *page,pte_t *ptep,bool check_swap, +bool pte_is_tagged) {pte_t old_pte =READ_ONCE (*ptep);if (check_swap &&is_swap_pte (old_pte)) {swp_entry_t entry =pte_to_swp_entry (old_pte); -if (!non_swap_entry (entry) &&mte_restore_tags (entry, page)) +if (!non_swap_entry (entry) &&mte_restore_tags (entry, page)) { +set_bit (PG_mte_tagged, &page->flags);return ; + } } +if (!pte_is_tagged ||test_and_set_bit (PG_mte_tagged, &page->flags)) +return ; +page_kasan_tag_reset (page);/* * We need smp_wmb() in between setting the flags and clearing the
@@ -53,11 +59,13 @@ void mte_sync_tags(pte_t *ptep, pte_t pte)struct page *page =pte_page (pte);long i, nr_pages =compound_nr (page);bool check_swap = nr_pages ==1 ; +bool pte_is_tagged =pte_tagged (pte);/* if PG_mte_tagged is set, tags have already been initialised */ for (i =0 ; i < nr_pages; i++, page++) { -if (!test_and_set_bit (PG_mte_tagged, &page->flags)) -mte_sync_page_tags (page, ptep, check_swap); +if (!test_bit (PG_mte_tagged, &page->flags)) +mte_sync_page_tags (page, ptep, check_swap, + pte_is_tagged); } }
Signature · 6 lines
2.20.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v8 2/5 arm64: kvm: Introduce MTE VM feature
In reply to Steven PriceAdd a new VM feature 'KVM_ARM_CAP_MTE' which enables memory tagging for a VM. This will expose the feature to the guest and automatically tag memory pages touched by the VM as PG_mte_tagged (and clear the tag storage) to ensure that the guest cannot see stale tags, and so that the tags are correctly saved/restored across swap.
Actually exposing the new capability to user space happens in a later patch.
--- arch/arm64/include/asm/kvm_emulate.h | 3 +++ arch/arm64/include/asm/kvm_host.h | 3 +++ arch/arm64/kvm/hyp/exception.c | 3 ++- arch/arm64/kvm/mmu.c | 16 ++++++++++++++++ arch/arm64/kvm/sys_regs.c | 3 ++- include/uapi/linux/kvm.h | 1 + 6 files changed, 27 insertions(+), 2 deletions(-)
arch/arm64/include/asm/kvm_emulate.h +3 -0
@@ -84,6 +84,9 @@ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)if (cpus_have_const_cap (ARM64_MISMATCHED_CACHE_TYPE ) ||vcpu_el1_is_32bit (vcpu)) vcpu->arch.hcr_el2 |=HCR_TID2 ; + +if (kvm_has_mte (vcpu->kvm)) + vcpu->arch.hcr_el2 |=HCR_ATA ; }static inline unsigned long *vcpu_hcr (struct kvm_vcpu *vcpu)
arch/arm64/include/asm/kvm_host.h +3 -0
@@ -132,6 +132,8 @@ struct kvm_arch {u8 pfr0_csv2;u8 pfr0_csv3; +/* Memory Tagging Extension enabled for the guest */ +bool mte_enabled; };struct kvm_vcpu_fault_info {
@@ -745,6 +747,7 @@ bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu);#define kvm_arm_vcpu_sve_finalized (vcpu) \ ((vcpu)->arch.flags & KVM_ARM64_VCPU_SVE_FINALIZED) +#define kvm_has_mte (kvm) (system_supports_mte() && (kvm)->arch.mte_enabled)#define kvm_vcpu_has_pmu (vcpu) \ (test_bit(KVM_ARM_VCPU_PMU_V3, (vcpu)->arch.features))
arch/arm64/kvm/hyp/exception.c +2 -1
@@ -112,7 +112,8 @@ static void enter_exception64(struct kvm_vcpu *vcpu, unsigned long target_mode, new |= (old &PSR_C_BIT ); new |= (old &PSR_V_BIT ); -// TODO: TCO (if/when ARMv8.5-MemTag is exposed to guests) +if (kvm_has_mte (vcpu->kvm)) + new |=PSR_TCO_BIT ; new |= (old &PSR_DIT_BIT );
arch/arm64/kvm/mmu.c +16 -0
@@ -879,6 +879,22 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,if (vma_pagesize ==PAGE_SIZE && !force_pte) vma_pagesize =transparent_hugepage_adjust (memslot, hva, &pfn, &fault_ipa); + +if (kvm_has_mte (kvm) &&pfn_valid (pfn)) { +/* +* VM will be able to see the page's tags, so we must ensure +* they have been initialised. if PG_mte_tagged is set, tags +* have already been initialised. +*/ +struct page *page =pfn_to_page (pfn); +unsigned long i, nr_pages = vma_pagesize >>PAGE_SHIFT ; + +for (i =0 ; i < nr_pages; i++, page++) { +if (!test_and_set_bit (PG_mte_tagged, &page->flags)) +mte_clear_page_tags (page_address (page)); + } + } +if (writable) { prot |=KVM_PGTABLE_PROT_W ;kvm_set_pfn_dirty (pfn);
arch/arm64/kvm/sys_regs.c +2 -1
@@ -1029,7 +1029,8 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, val &= ~(0xfUL <<ID_AA64PFR0_CSV3_SHIFT ); val |= ((u64 )vcpu->kvm->arch.pfr0_csv3 <<ID_AA64PFR0_CSV3_SHIFT ); }else if (id ==SYS_ID_AA64PFR1_EL1 ) { - val &= ~(0xfUL <<ID_AA64PFR1_MTE_SHIFT ); +if (!kvm_has_mte (vcpu->kvm)) + val &= ~(0xfUL <<ID_AA64PFR1_MTE_SHIFT ); }else if (id ==SYS_ID_AA64ISAR1_EL1 && !vcpu_has_ptrauth (vcpu)) { val &= ~((0xfUL << ID_AA64ISAR1_APA_SHIFT) | (0xfUL << ID_AA64ISAR1_API_SHIFT) |
include/uapi/linux/kvm.h +1 -0
@@ -1056,6 +1056,7 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190#define KVM_CAP_SYS_HYPERV_CPUID 191#define KVM_CAP_DIRTY_LOG_RING 192 +#define KVM_CAP_ARM_MTE 193#ifdef KVM_CAP_IRQ_ROUTING
Signature · 6 lines
2.20.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v8 3/5 arm64: kvm: Save/restore MTE registers
In reply to Steven PriceDefine the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet.
--- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/include/asm/kvm_mte.h | 66 ++++++++++++++++++++++ arch/arm64/include/asm/sysreg.h | 3 +- arch/arm64/kernel/asm-offsets.c | 3 + arch/arm64/kvm/hyp/entry.S | 7 +++ arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 21 +++++++ arch/arm64/kvm/sys_regs.c | 22 ++++++-- 7 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 arch/arm64/include/asm/kvm_mte.h
arch/arm64/include/asm/kvm_host.h +6 -0
@@ -208,6 +208,12 @@ enum vcpu_sysreg {CNTP_CVAL_EL0 ,CNTP_CTL_EL0 , +/* Memory Tagging Extension registers */ +RGSR_EL1 ,/* Random Allocation Tag Seed Register */ +GCR_EL1 ,/* Tag Control Register */ +TFSR_EL1 ,/* Tag Fault Status Register (EL1) */ +TFSRE0_EL1 ,/* Tag Fault Status Register (EL0) */ +/* 32bit specific registers. Keep them at the end of the range */ DACR32_EL2 ,/* Domain Access Control Register */ IFSR32_EL2, /* Instruction Fault Status Register */
arch/arm64/include/asm/kvm_mte.h new file +66 -0
66 lines not on this page · raw message
arch/arm64/include/asm/sysreg.h +2 -1
@@ -574,7 +574,8 @@#define SCTLR_ELx_M (BIT(0))#define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \ - SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_IESB) + SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_IESB | \ + SCTLR_ELx_ITFSB)/* SCTLR_EL2 specific flags. */ #define SCTLR_EL2_RES1 ((BIT(4)) | (BIT(5)) | (BIT(11)) | (BIT(16)) | \
arch/arm64/kernel/asm-offsets.c +3 -0
@@ -105,6 +105,9 @@ int main(void) DEFINE(VCPU_WORKAROUND_FLAGS, offsetof(struct kvm_vcpu, arch.workaround_flags)); DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2));DEFINE (CPU_USER_PT_REGS , offsetof(struct kvm_cpu_context , regs)); + DEFINE(CPU_RGSR_EL1, offsetof(struct kvm_cpu_context, sys_regs[RGSR_EL1])); + DEFINE(CPU_GCR_EL1, offsetof(struct kvm_cpu_context, sys_regs[GCR_EL1])); + DEFINE(CPU_TFSRE0_EL1, offsetof(struct kvm_cpu_context, sys_regs[TFSRE0_EL1])); DEFINE(CPU_APIAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APIAKEYLO_EL1])); DEFINE(CPU_APIBKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APIBKEYLO_EL1])); DEFINE(CPU_APDAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APDAKEYLO_EL1]));
arch/arm64/kvm/hyp/entry.S +7 -0
@@ -13,6 +13,7 @@ #include <asm/kvm_arm.h> #include <asm/kvm_asm.h> #include <asm/kvm_mmu.h> +#include <asm/kvm_mte.h> #include <asm/kvm_ptrauth.h> .text
@@ -51,6 +52,9 @@ alternative_else_nop_endif add x29, x0, #VCPU_CONTEXT + // mte_switch_to_guest(g_ctxt, h_ctxt, tmp1) + mte_switch_to_guest x29, x1, x2 + // Macro ptrauth_switch_to_guest format: // ptrauth_switch_to_guest(guest cxt, tmp1, tmp2, tmp3) // The below macro to restore guest keys is not implemented in C code
@@ -140,6 +144,9 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) // when this feature is enabled for kernel code. ptrauth_switch_to_hyp x1, x2, x3, x4, x5 + // mte_switch_to_hyp(g_ctxt, h_ctxt, reg1) + mte_switch_to_hyp x1, x2, x3 + // Restore hyp's sp_el0 restore_sp_el0 x2, x3
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h +21 -0
@@ -14,6 +14,7 @@#include <asm/kvm_asm.h> #include <asm/kvm_emulate.h> #include <asm/kvm_hyp.h> +#include <asm/kvm_mmu.h> static inline void __sysreg_save_common_state (struct kvm_cpu_context *ctxt) {
@@ -26,6 +27,16 @@ static inline void __sysreg_save_user_state(struct kvm_cpu_context *ctxt)ctxt_sys_reg (ctxt,TPIDRRO_EL0 ) =read_sysreg (tpidrro_el0); } +static inline bool ctxt_has_mte (struct kvm_cpu_context *ctxt) +{ +struct kvm_vcpu *vcpu = ctxt->__hyp_running_vcpu; + +if (!vcpu) + vcpu = container_of(ctxt, struct kvm_vcpu, arch.ctxt); + +return kvm_has_mte (kern_hyp_va (vcpu->kvm)); +} +static inline void __sysreg_save_el1_state (struct kvm_cpu_context *ctxt) {ctxt_sys_reg (ctxt,CSSELR_EL1 ) =read_sysreg (csselr_el1);
@@ -46,6 +57,11 @@ static inline void __sysreg_save_el1_state(struct kvm_cpu_context *ctxt)ctxt_sys_reg (ctxt,PAR_EL1 ) =read_sysreg_par ();ctxt_sys_reg (ctxt,TPIDR_EL1 ) =read_sysreg (tpidr_el1); +if (ctxt_has_mte (ctxt)) { +ctxt_sys_reg (ctxt,TFSR_EL1 ) =read_sysreg_el1 (SYS_TFSR ); +ctxt_sys_reg (ctxt,TFSRE0_EL1 ) =read_sysreg_s (SYS_TFSRE0_EL1 ); + } +ctxt_sys_reg (ctxt,SP_EL1 ) =read_sysreg (sp_el1);ctxt_sys_reg (ctxt,ELR_EL1 ) =read_sysreg_el1 (SYS_ELR );ctxt_sys_reg (ctxt,SPSR_EL1 ) =read_sysreg_el1 (SYS_SPSR );
@@ -107,6 +123,11 @@ static inline void __sysreg_restore_el1_state(struct kvm_cpu_context *ctxt)write_sysreg (ctxt_sys_reg (ctxt,PAR_EL1 ), par_el1);write_sysreg (ctxt_sys_reg (ctxt,TPIDR_EL1 ), tpidr_el1); +if (ctxt_has_mte (ctxt)) { +write_sysreg_el1 (ctxt_sys_reg (ctxt,TFSR_EL1 ),SYS_TFSR ); +write_sysreg_s (ctxt_sys_reg (ctxt,TFSRE0_EL1 ),SYS_TFSRE0_EL1 ); + } +if (!has_vhe () &&cpus_have_final_cap (ARM64_WORKAROUND_SPECULATIVE_AT ) && ctxt->__hyp_running_vcpu) {
arch/arm64/kvm/sys_regs.c +18 -4
@@ -1282,6 +1282,20 @@ static bool access_ccsidr(struct kvm_vcpu *vcpu, struct sys_reg_params *p,return true; } +static unsigned int mte_visibility (const struct kvm_vcpu *vcpu, +const struct sys_reg_desc *rd) +{ +return REG_HIDDEN ; +} + +#define MTE_REG (name) { \ + SYS_DESC(SYS_##name), \ + .access = undef_access, \ + .reset = reset_unknown, \ + .reg = name, \ + .visibility = mte_visibility, \ +} +/* sys_reg_desc initialiser for known cpufeature ID registers */ #define ID_SANITISED (name) { \ SYS_DESC(SYS_##name), \
@@ -1450,8 +1464,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { { SYS_DESC(SYS_ACTLR_EL1), access_actlr, reset_actlr, ACTLR_EL1 }, { SYS_DESC(SYS_CPACR_EL1), NULL, reset_val, CPACR_EL1, 0 }, - { SYS_DESC(SYS_RGSR_EL1), undef_access }, - { SYS_DESC(SYS_GCR_EL1), undef_access }, +MTE_REG (RGSR_EL1 ), +MTE_REG (GCR_EL1 ), { SYS_DESC(SYS_ZCR_EL1), NULL, reset_val, ZCR_EL1, 0, .visibility = sve_visibility }, { SYS_DESC(SYS_TTBR0_EL1), access_vm_reg, reset_unknown, TTBR0_EL1 },
@@ -1477,8 +1491,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { { SYS_DESC(SYS_ERXMISC0_EL1), trap_raz_wi }, { SYS_DESC(SYS_ERXMISC1_EL1), trap_raz_wi }, - { SYS_DESC(SYS_TFSR_EL1), undef_access }, - { SYS_DESC(SYS_TFSRE0_EL1), undef_access }, +MTE_REG (TFSR_EL1 ), +MTE_REG (TFSRE0_EL1 ), { SYS_DESC(SYS_FAR_EL1), access_vm_reg, reset_unknown, FAR_EL1 }, { SYS_DESC(SYS_PAR_EL1), NULL, reset_unknown, PAR_EL1 },
Signature · 6 lines
2.20.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v8 4/5 arm64: kvm: Expose KVM_ARM_CAP_MTE
In reply to Steven PriceIt's now safe for the VMM to enable MTE in a guest, so expose the capability to user space.
--- arch/arm64/kvm/arm.c | 9 +++++++++ arch/arm64/kvm/sys_regs.c | 3 +++ 2 files changed, 12 insertions(+)
arch/arm64/kvm/arm.c +9 -0
@@ -97,6 +97,12 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, r =0 ; kvm->arch.return_nisv_io_abort_to_user = true;break ; +case KVM_CAP_ARM_MTE : +if (!system_supports_mte () || kvm->created_vcpus) +return -EINVAL ; + r =0 ; + kvm->arch.mte_enabled = true; +break ;default : r = -EINVAL ;break ;
@@ -238,6 +244,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)*/ r =1 ;break ; +case KVM_CAP_ARM_MTE : + r =system_supports_mte (); +break ;case KVM_CAP_STEAL_TIME : r =kvm_arm_pvtime_supported ();break ;
arch/arm64/kvm/sys_regs.c +3 -0
@@ -1285,6 +1285,9 @@ static bool access_ccsidr(struct kvm_vcpu *vcpu, struct sys_reg_params *p,static unsigned int mte_visibility (const struct kvm_vcpu *vcpu,const struct sys_reg_desc *rd) { +if (kvm_has_mte (vcpu->kvm)) +return 0 ; +return REG_HIDDEN ; }
Signature · 6 lines
2.20.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
RFC PATCH v8 5/5 KVM: arm64: ioctl to fetch/store tags in a guest
In reply to Steven PriceThe VMM may not wish to have it's own mapping of guest memory mapped with PROT_MTE because this causes problems if the VMM has tag checking enabled (the guest controls the tags in physical RAM and it's unlikely the tags are correct for the VMM).
Instead add a new ioctl which allows the VMM to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration.
--- arch/arm64/include/uapi/asm/kvm.h | 13 +++++++ arch/arm64/kvm/arm.c | 57 +++++++++++++++++++++++++++++++ include/uapi/linux/kvm.h | 1 + 3 files changed, 71 insertions(+)
arch/arm64/include/uapi/asm/kvm.h +13 -0
@@ -184,6 +184,19 @@ struct kvm_vcpu_events {__u32 reserved[12 ]; }; +struct kvm_arm_copy_mte_tags { +__u64 guest_ipa; +__u64 length; +union { +void __user *addr; +__u64 padding; + }; +__u64 flags; +}; + +#define KVM_ARM_TAGS_TO_GUEST 0 +#define KVM_ARM_TAGS_FROM_GUEST 1 +/* If you need to interpret the index values, here is the key: */ #define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000#define KVM_REG_ARM_COPROC_SHIFT 16
arch/arm64/kvm/arm.c +57 -0
69 lines not on this page · raw message
include/uapi/linux/kvm.h +1 -0
@@ -1397,6 +1397,7 @@ struct kvm_s390_ucas_mapping {/* Available with KVM_CAP_PMU_EVENT_FILTER */ #define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)#define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3) +#define KVM_ARM_MTE_COPY_TAGS _IOR(KVMIO, 0xb4, struct kvm_arm_copy_mte_tags)/* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
Signature · 6 lines
2.20.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [RFC PATCH v8 5/5] KVM: arm64: ioctl to fetch/store tags in a guest
Quoted 11 lines · Steven Price
The VMM may not wish to have it's own mapping of guest memory mapped with
PROT_MTEbecause this causes problems if the VMM has tag checking enabled (the guest controls the tags in physical RAM and it's unlikely the tags are correct for the VMM).Instead add a new ioctl which allows the VMM to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration.
Quoted 6 lines
Signed-off-by Steven Price <[email protected]>--- arch/arm64/include/uapi/asm/kvm.h | 13 +++++++ arch/arm64/kvm/arm.c | 57 +++++++++++++++++++++++++++++++ include/uapi/linux/kvm.h | 1 + 3 files changed, 71 insertions(+)
Missing the update to the docs in Documentation/virtual/kvm/api.txt :-)
thanks
-- PMM
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [RFC PATCH v8 5/5] KVM: arm64: ioctl to fetch/store tags in a guest
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Steven Price
The VMM may not wish to have it's own mapping of guest memory mapped with
PROT_MTEbecause this causes problems if the VMM has tag checking enabled (the guest controls the tags in physical RAM and it's unlikely the tags are correct for the VMM).Instead add a new ioctl which allows the VMM to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Steven Price <[email protected]>--- arch/arm64/include/uapi/asm/kvm.h | 13 +++++++ arch/arm64/kvm/arm.c | 57 +++++++++++++++++++++++++++++++ include/uapi/linux/kvm.h | 1 + 3 files changed, 71 insertions(+)Missing the update to the docs in
Documentation/virtual/kvm/api.txt:-)
Good point - although I was secretly hoping to get some feedback on the concepts before writing the documentation! But I guess the documentation will help with the review. I'll include some in the next posting.
Thanks,
Steve
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm