Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1559b75

Browse files
James MorseMarc Zyngier
James Morse
authored and
Marc Zyngier
committed
KVM: arm/arm64: Re-check VMA on detecting a poisoned page
When we check for a poisoned page, we use the VMA to tell userspaceabout the looming disaster. But we pass a pointer to this VMAafter having released the mmap_sem, which isn't a good idea.Instead, stash the shift value that goes with this pfn whilewe are holding the mmap_sem.Reported-by: Marc Zyngier <maz@kernel.org>Signed-off-by: James Morse <james.morse@arm.com>Signed-off-by: Marc Zyngier <maz@kernel.org>Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>Link:https://lore.kernel.org/r/20191211165651.7889-3-maz@kernel.orgLink:https://lore.kernel.org/r/20191217123809.197392-1-james.morse@arm.com
1 parentde93756 commit1559b75

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

‎virt/kvm/arm/mmu.c‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,16 +1596,8 @@ static void invalidate_icache_guest_page(kvm_pfn_t pfn, unsigned long size)
15961596
__invalidate_icache_guest_page(pfn,size);
15971597
}
15981598

1599-
staticvoidkvm_send_hwpoison_signal(unsigned longaddress,
1600-
structvm_area_struct*vma)
1599+
staticvoidkvm_send_hwpoison_signal(unsigned longaddress,shortlsb)
16011600
{
1602-
shortlsb;
1603-
1604-
if (is_vm_hugetlb_page(vma))
1605-
lsb=huge_page_shift(hstate_vma(vma));
1606-
else
1607-
lsb=PAGE_SHIFT;
1608-
16091601
send_sig_mceerr(BUS_MCEERR_AR, (void__user*)address,lsb,current);
16101602
}
16111603

@@ -1678,6 +1670,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
16781670
structkvm*kvm=vcpu->kvm;
16791671
structkvm_mmu_memory_cache*memcache=&vcpu->arch.mmu_page_cache;
16801672
structvm_area_struct*vma;
1673+
shortvma_shift;
16811674
kvm_pfn_tpfn;
16821675
pgprot_tmem_type=PAGE_S2;
16831676
boollogging_active=memslot_is_logging(memslot);
@@ -1701,7 +1694,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
17011694
return-EFAULT;
17021695
}
17031696

1704-
vma_pagesize=vma_kernel_pagesize(vma);
1697+
if (is_vm_hugetlb_page(vma))
1698+
vma_shift=huge_page_shift(hstate_vma(vma));
1699+
else
1700+
vma_shift=PAGE_SHIFT;
1701+
1702+
vma_pagesize=1ULL <<vma_shift;
17051703
if (logging_active||
17061704
(vma->vm_flags&VM_PFNMAP)||
17071705
!fault_supports_stage2_huge_mapping(memslot,hva,vma_pagesize)) {
@@ -1741,7 +1739,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
17411739

17421740
pfn=gfn_to_pfn_prot(kvm,gfn,write_fault,&writable);
17431741
if (pfn==KVM_PFN_ERR_HWPOISON) {
1744-
kvm_send_hwpoison_signal(hva,vma);
1742+
kvm_send_hwpoison_signal(hva,vma_shift);
17451743
return0;
17461744
}
17471745
if (is_error_noslot_pfn(pfn))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp