From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6679CC3815B for ; Mon, 20 Apr 2020 04:16:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2237520661 for ; Mon, 20 Apr 2020 04:16:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2237520661 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 83D578E0005; Mon, 20 Apr 2020 00:16:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EE3E8E0003; Mon, 20 Apr 2020 00:16:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 704618E0005; Mon, 20 Apr 2020 00:16:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id 55B798E0003 for ; Mon, 20 Apr 2020 00:16:04 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0A7FF180ACF8F for ; Mon, 20 Apr 2020 04:16:04 +0000 (UTC) X-FDA: 76726920648.10.ball39_17930675ced4d X-HE-Tag: ball39_17930675ced4d X-Filterd-Recvd-Size: 5008 Received: from r3-18.sinamail.sina.com.cn (r3-18.sinamail.sina.com.cn [202.108.3.18]) by imf28.hostedemail.com (Postfix) with SMTP for ; Mon, 20 Apr 2020 04:15:58 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([114.253.228.166]) by sina.com with ESMTP id 5E9D21EF0003607E; Mon, 20 Apr 2020 12:15:44 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 64394715073444 From: Hillf Danton To: syzbot Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Minchan Kim , Johannes Weiner , linux-mm@kvack.org, syzkaller-bugs@googlegroups.com Subject: Re: kernel BUG at include/linux/mm.h:699 Date: Mon, 20 Apr 2020 12:15:33 +0800 Message-Id: <20200420041533.5304-1-hdanton@sina.com> In-Reply-To: <0000000000005103e405a3a66ecd@google.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Sun, 19 Apr 2020 08:28:14 -0700 > syzbot found the following crash on: >=20 > HEAD commit: 8632e9b5 Merge tag 'hyperv-fixes-signed' of git://git.k= ern.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=3D11ac6be0100= 000 > kernel config: https://syzkaller.appspot.com/x/.config?x=3D5d351a1019e= d81a2 > dashboard link: https://syzkaller.appspot.com/bug?extid=3Da923008018a2d= 298247b > compiler: gcc (GCC) 9.0.0 20181231 (experimental) >=20 > Unfortunately, I don't have any reproducer for this crash yet. >=20 > IMPORTANT: if you fix the bug, please add the following tag to the comm= it: > Reported-by: syzbot+a923008018a2d298247b@syzkaller.appspotmail.com >=20 > raw: 0000000000000000 0000000000000000 00000000ffffffff 000000000000000= 0 > page dumped because: VM_BUG_ON_PAGE(page_ref_count(page) =3D=3D 0) > ------------[ cut here ]------------ > kernel BUG at include/linux/mm.h:699! > invalid opcode: 0000 [#1] PREEMPT SMP KASAN > CPU: 0 PID: 14511 Comm: syz-executor.4 Not tainted 5.7.0-rc1-syzkaller = #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS= Google 01/01/2011 > RIP: 0010:put_page_testzero include/linux/mm.h:699 [inline] > RIP: 0010:put_page_testzero include/linux/mm.h:697 [inline] > RIP: 0010:release_pages+0x799/0x19b0 mm/swap.c:823 > Code: c7 f9 ff ff e8 38 9d dd ff 48 89 ef e8 20 ac ff ff e9 96 fe ff ff= e8 26 9d dd ff 48 c7 c6 c0 44 33 88 48 89 ef e8 87 86 09 00 <0f> 0b e8 1= 0 9d dd ff 49 8d 6c 24 ff e9 c5 f9 ff ff 4c 8d 6d 08 31 > RSP: 0018:ffffc90007fb7640 EFLAGS: 00010293 > RAX: ffff8880a19f4280 RBX: 0000000000000000 RCX: ffffffff819f2d28 > RDX: 0000000000000000 RSI: ffffffff819596e9 RDI: ffffea0000000038 > RBP: ffffea0000000000 R08: ffff8880a19f4280 R09: ffffed1015cc66a9 > R10: ffff8880ae633547 R11: ffffed1015cc66a8 R12: ffffea0000000034 > R13: 0000000000000000 R14: dffffc0000000000 R15: 00000000000000c6 > FS: 00007fc0946fc700(0000) GS:ffff8880ae600000(0000) knlGS:00000000000= 00000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00007f2142ba1db8 CR3: 000000008859f000 CR4: 00000000001426f0 > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > Call Trace: > tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] > tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] > tlb_flush_mmu+0x8d/0x610 mm/mmu_gather.c:249 > zap_pte_range mm/memory.c:1158 [inline] > zap_pmd_range mm/memory.c:1196 [inline] > zap_pud_range mm/memory.c:1225 [inline] > zap_p4d_range mm/memory.c:1246 [inline] > unmap_page_range+0x198d/0x25d0 mm/memory.c:1267 > unmap_single_vma+0x196/0x300 mm/memory.c:1312 > unmap_vmas+0x16f/0x2f0 mm/memory.c:1344 > exit_mmap+0x2aa/0x510 mm/mmap.c:3150 > __mmput kernel/fork.c:1085 [inline] > mmput+0x168/0x4b0 kernel/fork.c:1106 > exit_mm kernel/exit.c:479 [inline] > do_exit+0xa51/0x2dd0 kernel/exit.c:782 > do_group_exit+0x125/0x340 kernel/exit.c:893 > get_signal+0x47b/0x24e0 kernel/signal.c:2739 > do_signal+0x81/0x2240 arch/x86/kernel/signal.c:784 > exit_to_usermode_loop+0x26c/0x360 arch/x86/entry/common.c:161 > prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] > syscall_return_slowpath arch/x86/entry/common.c:279 [inline] > do_syscall_64+0x6b1/0x7d0 arch/x86/entry/common.c:305 > entry_SYSCALL_64_after_hwframe+0x49/0xb3 Flush TLB every chance before we get every thing done. --- a/mm/memory.c +++ b/mm/memory.c @@ -1080,8 +1080,8 @@ again: page_remove_rmap(page, false); if (unlikely(page_mapcount(page) < 0)) print_bad_pte(vma, addr, ptent, page); + force_flush =3D 1; if (unlikely(__tlb_remove_page(tlb, page))) { - force_flush =3D 1; addr +=3D PAGE_SIZE; break; } @@ -1146,10 +1146,9 @@ again: tlb_flush_mmu(tlb); } =20 - if (addr !=3D end) { - cond_resched(); + cond_resched(); + if (addr !=3D end) goto again; - } =20 return addr; }