Re: [syzbot] [btrfs?] kernel BUG in folio_unlock (2)

From: David Sterba
Date: Wed May 15 2024 - 12:46:06 EST


On Thu, May 02, 2024 at 09:24:30AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 9c6ecb3cb6e2 Add linux-next specific files for 20240502
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=17418c40980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=25ba1e5e9c955f1a
> dashboard link: https://syzkaller.appspot.com/bug?extid=9e39ac154d8781441e60
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15e4117f180000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10efe5f8980000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/dc32e924f570/disk-9c6ecb3c.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/7bc65d787cc9/vmlinux-9c6ecb3c.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/19096ecded11/bzImage-9c6ecb3c.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/45e18da02dc2/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+9e39ac154d8781441e60@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> reset_page_owner include/linux/page_owner.h:25 [inline]
> free_pages_prepare mm/page_alloc.c:1088 [inline]
> free_unref_page+0xd22/0xea0 mm/page_alloc.c:2601
> free_contig_range+0x9e/0x160 mm/page_alloc.c:6655
> destroy_args+0x8a/0x890 mm/debug_vm_pgtable.c:1037
> debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1417
> do_one_initcall+0x248/0x880 init/main.c:1265
> do_initcall_level+0x157/0x210 init/main.c:1327
> do_initcalls+0x3f/0x80 init/main.c:1343
> kernel_init_freeable+0x435/0x5d0 init/main.c:1576
> kernel_init+0x1d/0x2b0 init/main.c:1465
> ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
> ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> ------------[ cut here ]------------
> kernel BUG at mm/filemap.c:1507!

VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);

fs/btrfs/extent_io.c:

1514 if (ret) {
1515 btrfs_mark_ordered_io_finished(BTRFS_I(inode), page, page_start,
1516 PAGE_SIZE, !ret);
1517 mapping_set_error(page->mapping, ret);
1518 }
1519 unlock_page(page);
^^^^
1520 ASSERT(ret <= 0);
1521 return ret;
1522 }

Trying to unlock a page that's not locked.

Code last touched by 9783e4deed7291996459858a1a16