Re: general protection fault in khugepaged

From: Kirill A. Shutemov
Date: Fri Jul 17 2020 - 19:10:33 EST


On Fri, Jul 17, 2020 at 03:40:04PM -0700, syzbot wrote:
> syzbot has bisected this issue to:
>
> commit ffe945e633b527d5a4577b42cbadec3c7cbcf096
> Author: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Date: Wed Jun 3 23:00:09 2020 +0000
>
> khugepaged: do not stop collapse if less than half PTEs are referenced
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=17356c2f100000
> start commit: e44f65fd xen-netfront: remove redundant assignment to vari..
> git tree: net-next
> final oops: https://syzkaller.appspot.com/x/report.txt?x=14b56c2f100000
> console output: https://syzkaller.appspot.com/x/log.txt?x=10b56c2f100000
> kernel config: https://syzkaller.appspot.com/x/.config?x=829871134ca5e230
> dashboard link: https://syzkaller.appspot.com/bug?extid=ed318e8b790ca72c5ad0
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=113406a7100000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=175597d3100000
>
> Reported-by: syzbot+ed318e8b790ca72c5ad0@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: ffe945e633b5 ("khugepaged: do not stop collapse if less than half PTEs are referenced")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection
>

My guess is that anonymous VMA got replaced by file VMA under us.

Could you reproduce the issue with the patch below? I have hard time
triggering it myself.

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index b043c40a21d4..f8ec58a1e72b 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1107,6 +1107,8 @@ static void collapse_huge_page(struct mm_struct *mm,
if (mm_find_pmd(mm, address) != pmd)
goto out;

+ if (!vma->anon_vma)
+ dump_vma(vma);
anon_vma_lock_write(vma->anon_vma);

mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm,
--
Kirill A. Shutemov