iommu/amd: Fix BUG when faulting a PROT_NONE VMA
PATCH RESEND 1/1 iommu/amd: Fix BUG when faulting a PROT_NONE VMA
handle_mm_fault indirectly triggers a BUG in do_numa_page when given a VMA without read/write/execute access. Check this condition in do_fault.
do_fault -> handle_mm_fault -> handle_pte_fault -> do_numa_page
mm/memory.c
3147 static int do_numa_page(struct mm_struct *mm, struct vm_area_st...
....
3159 /* A PROT_NONE fault should not end up here */
3160 BUG_ON(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)));
--- drivers/iommu/amd_iommu_v2.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/amd_iommu_v2.c +7 -0
@@ -516,6 +516,13 @@ static void do_fault(struct work_struct *work) goto out; } +if (!(vma->vm_flags & (VM_READ |VM_EXEC |VM_WRITE ))) { +/* handle_mm_fault would BUG_ON() */ +up_read (&mm->mmap_sem); +handle_fault_error (fault); + goto out; + } + ret =handle_mm_fault (mm, vma, address, write);if (ret &VM_FAULT_ERROR ) {/* failed to service fault */
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): 1444729963-13815-1-git-send-email-jay-gJmSnxjMpeIFV7jr3Ov9Ew@public.gmane.org
Hi Jay,
Quoted 10 lines · Jay Cornwall
handle_mm_faultindirectly triggers a BUG indo_numa_pagewhen given a VMA without read/write/execute access. Check this condition indo_fault.
do_fault->handle_mm_fault->handle_pte_fault->do_numa_page
mm/memory.c
3147 static int do_numa_page(structmm_struct*mm, structvm_area_st...
....
3159 /* APROT_NONEfault should not end up here */
3160BUG_ON(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)));
Thanks for the fix! Next time please Cc me directly on patches for AMD IOMMU code, so I see your patches earlier.
Also this looks relevant for stable, can you find out which stable kernels need this fix too?
Thanks,
Joerg
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 15 lines · Joerg Roedel
Hi Jay,
Quoted 11 lines · Jay Cornwall
handle_mm_faultindirectly triggers a BUG indo_numa_pagewhen given a VMA without read/write/execute access. Check this condition indo_fault.
do_fault->handle_mm_fault->handle_pte_fault->do_numa_page
mm/memory.c
3147 static int do_numa_page(structmm_struct*mm, structvm_area_st...
....
3159 /* APROT_NONEfault should not end up here */ 3160BUG_ON(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)));
Quoted 5 lines
Thanks for the fix! Next time please Cc me directly on patches for AMD IOMMU code, so I see your patches earlier.
Also this looks relevant for stable, can you find out which stable kernels need this fix too?
Sure.
Signature · 1 line
Jay Cornwall
A message that is not in the archive (sent off-list or not yet received): 0528b4ee6c9af3fa326880eb18cf13b8-gJmSnxjMpeIFV7jr3Ov9Ew@public.gmane.org
Joerg Roedel
AppliedQuoted 20 lines · Jay Cornwall
Quoted 19 lines · Joerg Roedel
Hi Jay,
Quoted 4 lines · Jay Cornwall
handle_mm_faultindirectly triggers a BUG indo_numa_pagewhen given a VMA without read/write/execute access. Check this condition indo_fault.Quoted 8 lines
do_fault->handle_mm_fault->handle_pte_fault->do_numa_page
mm/memory.c
3147 static int do_numa_page(structmm_struct*mm, structvm_area_st...
....
3159 /* APROT_NONEfault should not end up here */ 3160BUG_ON(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)));Thanks for the fix! Next time please Cc me directly on patches for AMD IOMMU code, so I see your patches earlier.
Quoted 6 lines
Quoted 2 lines
Also this looks relevant for stable, can you find out which stable kernels need this fix too?
Sure.
Cc <[email protected]> # v4.1+
Applied, thanks.