Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

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

Merge tag 'kvmarm-fixes-5.8-4' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master

KVM/arm64 fixes for Linux 5.8, take #3

- Fix a corner case of a new mapping inheriting exec permission without
and yet bypassing invalidation of the I-cache
- Make sure PtrAuth predicates oinly generate inline code for the
non-VHE hypervisor code

+14 -8
+8 -3
arch/arm64/include/asm/kvm_host.h
··· 380 380 #define vcpu_has_sve(vcpu) (system_supports_sve() && \ 381 381 ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_SVE)) 382 382 383 - #define vcpu_has_ptrauth(vcpu) ((system_supports_address_auth() || \ 384 - system_supports_generic_auth()) && \ 385 - ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_PTRAUTH)) 383 + #ifdef CONFIG_ARM64_PTR_AUTH 384 + #define vcpu_has_ptrauth(vcpu) \ 385 + ((cpus_have_final_cap(ARM64_HAS_ADDRESS_AUTH) || \ 386 + cpus_have_final_cap(ARM64_HAS_GENERIC_AUTH)) && \ 387 + (vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_PTRAUTH) 388 + #else 389 + #define vcpu_has_ptrauth(vcpu) false 390 + #endif 386 391 387 392 #define vcpu_gp_regs(v) (&(v)->arch.ctxt.gp_regs) 388 393
+6 -5
arch/arm64/kvm/mmu.c
··· 1326 1326 return true; 1327 1327 } 1328 1328 1329 - static bool stage2_is_exec(struct kvm *kvm, phys_addr_t addr) 1329 + static bool stage2_is_exec(struct kvm *kvm, phys_addr_t addr, unsigned long sz) 1330 1330 { 1331 1331 pud_t *pudp; 1332 1332 pmd_t *pmdp; ··· 1338 1338 return false; 1339 1339 1340 1340 if (pudp) 1341 - return kvm_s2pud_exec(pudp); 1341 + return sz <= PUD_SIZE && kvm_s2pud_exec(pudp); 1342 1342 else if (pmdp) 1343 - return kvm_s2pmd_exec(pmdp); 1343 + return sz <= PMD_SIZE && kvm_s2pmd_exec(pmdp); 1344 1344 else 1345 - return kvm_s2pte_exec(ptep); 1345 + return sz == PAGE_SIZE && kvm_s2pte_exec(ptep); 1346 1346 } 1347 1347 1348 1348 static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache, ··· 1958 1958 * execute permissions, and we preserve whatever we have. 1959 1959 */ 1960 1960 needs_exec = exec_fault || 1961 - (fault_status == FSC_PERM && stage2_is_exec(kvm, fault_ipa)); 1961 + (fault_status == FSC_PERM && 1962 + stage2_is_exec(kvm, fault_ipa, vma_pagesize)); 1962 1963 1963 1964 if (vma_pagesize == PUD_SIZE) { 1964 1965 pud_t new_pud = kvm_pfn_pud(pfn, mem_type);