syzbot


KASAN: use-after-free Read in diFree

Status: upstream: reported C repro on 2022/03/22 12:48
Reported-by: syzbot+1964c915c8c3913b3d7a@syzkaller.appspotmail.com
First crash: 321d, last: 6d02h

Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: BUG: unable to handle kernel paging request in diFree (log)
Repro: C syz .config
similar bugs (7):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in diFree jfs C error 21 4d14h 842d 0/1 upstream: reported C repro on 2020/10/13 01:51
linux-4.14 KASAN: use-after-free Read in diFree C error 1 341d 855d 0/1 upstream: reported C repro on 2020/09/30 00:31
linux-4.19 BUG: unable to handle kernel paging request in diFree C done 18 564d 856d 1/1 fixed on 2021/08/17 00:59
linux-4.14 general protection fault in diFree 1 734d 734d 0/1 auto-closed as invalid on 2021/05/28 19:31
linux-4.14 general protection fault in diFree (2) C 2 7d09h 379d 0/1 upstream: reported C repro on 2022/01/18 19:31
upstream BUG: unable to handle kernel paging request in diFree C done 13 586d 857d 22/24 fixed on 2021/11/10 00:50
linux-4.14 BUG: unable to handle kernel paging request in diFree C 5 12d 861d 0/1 upstream: reported C repro on 2020/09/23 16:53
Last patch testing requests:
Created Duration User Patch Repo Result
2022/03/31 05:14 11m mudongliangabcd@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git -- OK

Sample crash report:
loop0: detected capacity change from 0 to 32768
==================================================================
BUG: KASAN: use-after-free in diFree+0x19c6/0x2660 fs/jfs/jfs_imap.c:871
Read of size 4 at addr ffff888025170004 by task syz-executor100/3652

CPU: 1 PID: 3652 Comm: syz-executor100 Not tainted 6.0.0-syzkaller-09589-g55be6084c8e0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:317 [inline]
 print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
 diFree+0x19c6/0x2660 fs/jfs/jfs_imap.c:871
 jfs_evict_inode+0x3c1/0x4a0 fs/jfs/inode.c:156
 evict+0x2ed/0x6b0 fs/inode.c:664
 iput_final fs/inode.c:1747 [inline]
 iput.part.0+0x55d/0x810 fs/inode.c:1773
 iput+0x58/0x70 fs/inode.c:1763
 diFreeSpecial+0x73/0x100 fs/jfs/jfs_imap.c:548
 jfs_umount+0x130/0x3f0 fs/jfs/jfs_umount.c:65
 jfs_fill_super+0xa47/0xc70 fs/jfs/super.c:600
 mount_bdev+0x34d/0x410 fs/super.c:1400
 legacy_get_tree+0x105/0x220 fs/fs_context.c:610
 vfs_get_tree+0x89/0x2f0 fs/super.c:1530
 do_new_mount fs/namespace.c:3040 [inline]
 path_mount+0x1326/0x1e20 fs/namespace.c:3370
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fd612e050ea
Code: 48 c7 c2 c0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 a8 00 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd56ffa298 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fd612e050ea
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffd56ffa2b0
RBP: 00007ffd56ffa2b0 R08: 00007ffd56ffa2f0 R09: 0000000000000002
R10: 0000000000000000 R11: 0000000000000282 R12: 0000000000000004
R13: 00007ffd56ffa2f0 R14: 0000000000000357 R15: 0000000020005228
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0000945c00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25170
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0000930a08 ffff8880b9b40820 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x40cc0(GFP_KERNEL|__GFP_COMP), pid 3652, tgid 3652 (syz-executor100), ts 51369622625, free_ts 51370801556
 prep_new_page mm/page_alloc.c:2532 [inline]
 get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5549
 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270
 kmalloc_order+0x34/0xf0 mm/slab_common.c:933
 kmalloc_order_trace+0x13/0x120 mm/slab_common.c:949
 kmalloc_large include/linux/slab.h:529 [inline]
 kmalloc include/linux/slab.h:593 [inline]
 diMount+0x2a/0x830 fs/jfs/jfs_imap.c:105
 jfs_mount+0x393/0x7b0 fs/jfs/jfs_mount.c:179
 jfs_fill_super+0x5a4/0xc70 fs/jfs/super.c:556
 mount_bdev+0x34d/0x410 fs/super.c:1400
 legacy_get_tree+0x105/0x220 fs/fs_context.c:610
 vfs_get_tree+0x89/0x2f0 fs/super.c:1530
 do_new_mount fs/namespace.c:3040 [inline]
 path_mount+0x1326/0x1e20 fs/namespace.c:3370
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1449 [inline]
 free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499
 free_unref_page_prepare mm/page_alloc.c:3380 [inline]
 free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476
 diUnmount+0xed/0x120 fs/jfs/jfs_imap.c:195
 jfs_umount+0x128/0x3f0 fs/jfs/jfs_umount.c:63
 jfs_fill_super+0xa47/0xc70 fs/jfs/super.c:600
 mount_bdev+0x34d/0x410 fs/super.c:1400
 legacy_get_tree+0x105/0x220 fs/fs_context.c:610
 vfs_get_tree+0x89/0x2f0 fs/super.c:1530
 do_new_mount fs/namespace.c:3040 [inline]
 path_mount+0x1326/0x1e20 fs/namespace.c:3370
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88802516ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802516ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888025170000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888025170080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888025170100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (26):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/10/13 20:16 upstream 55be6084c8e0 adf90437 .config strace log report syz C [disk image] [vmlinux] [mounted in repro] KASAN: use-after-free Read in diFree
ci-upstream-linux-next-kasan-gce-root 2022/10/29 02:51 linux-next 4d48f589d294 ea12ae9b .config strace log report syz C [disk image] [vmlinux] [mounted in repro] UBSAN: array-index-out-of-bounds in diFree
ci-upstream-linux-next-kasan-gce-root 2022/03/18 14:32 linux-next 91265a6da44d e2d91b1d .config console log report syz C general protection fault in diFree
ci2-upstream-fs 2023/01/23 06:59 upstream 2475bf0250de cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2023/01/23 06:39 upstream 2475bf0250de cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2023/01/13 23:23 upstream d9fc1511728c 529798b0 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2023/01/07 08:29 upstream 1f5abbd77e2c 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/12/24 09:29 upstream 51094a24b85e 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/12/23 00:11 upstream 0a924817d2ed 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/11/16 10:53 upstream 81e7cfa3a9eb 3a127a31 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/11/09 19:48 upstream f141df371335 bebca8b7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/10/31 04:11 upstream b229b6ca5abb 2a71366b .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/10/22 23:48 upstream 440b7895c990 c0b80a55 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/10/15 05:04 upstream 493ffd6605b2 67cb024c .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/10/12 04:19 upstream 493ffd6605b2 02b6492e .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/10/12 00:31 upstream 493ffd6605b2 02b6492e .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in diFree
ci2-upstream-fs 2022/10/09 06:59 upstream a6afa4199d3d aea5da89 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in diFree
ci-upstream-linux-next-kasan-gce-root 2022/03/18 12:43 linux-next 91265a6da44d e2d91b1d .config console log report info KASAN: use-after-free Read in diFree
ci2-upstream-fs 2023/01/27 13:28 upstream 7c46948a6e9c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] general protection fault in diFree
ci2-upstream-fs 2023/01/15 05:03 upstream 97ec4d559d93 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] general protection fault in diFree
ci2-upstream-fs 2022/11/01 13:51 upstream b229b6ca5abb a1d8560a .config console log report info [disk image] [vmlinux] [kernel image] UBSAN: array-index-out-of-bounds in diFree
ci-upstream-kasan-gce-selinux-root 2022/10/28 09:35 upstream b229b6ca5abb 86777b7f .config console log report info [disk image] [vmlinux] [kernel image] UBSAN: array-index-out-of-bounds in diFree
ci2-upstream-fs 2022/10/23 19:19 upstream d47136c28015 23bf86af .config console log report info [disk image] [vmlinux] UBSAN: array-index-out-of-bounds in diFree
ci2-upstream-fs 2022/10/03 03:36 upstream a962b54e162c feb56351 .config console log report info [disk image] [vmlinux] general protection fault in diFree
ci-upstream-gce-arm64 2022/11/20 23:33 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9500fc6e9e60 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] BUG: unable to handle kernel NULL pointer dereference in diFree
ci-upstream-gce-arm64 2022/09/21 17:48 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 4a4a085d97ce 380f82fb .config console log report info [disk image] [vmlinux] BUG: unable to handle kernel NULL pointer dereference in diFree
* Struck through repros no longer work on HEAD.