syzbot


KASAN: use-after-free Read in diSync

Status: auto-obsoleted due to no activity on 2023/09/29 16:20
Subsystems: jfs
[Documentation on labels]
Reported-by: syzbot+9ef09d851eb19bc94104@syzkaller.appspotmail.com
First crash: 387d, last: 313d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in diSync+0x54a/0x6e0 fs/jfs/jfs_imap.c:225
Read of size 4 at addr ffff88807d030000 by task syz-executor.2/5094

CPU: 1 PID: 5094 Comm: syz-executor.2 Not tainted 6.3.0-rc7-syzkaller-00043-gaf67688dca57 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:319 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:430
 kasan_report+0x176/0x1b0 mm/kasan/report.c:536
 diSync+0x54a/0x6e0 fs/jfs/jfs_imap.c:225
 diUnmount+0xbf/0x100 fs/jfs/jfs_imap.c:185
 jfs_umount+0x1c3/0x3a0 fs/jfs/jfs_umount.c:72
 jfs_put_super+0x8a/0x190 fs/jfs/super.c:194
 generic_shutdown_super+0x134/0x340 fs/super.c:500
 kill_block_super+0x7e/0xe0 fs/super.c:1407
 deactivate_locked_super+0xa4/0x110 fs/super.c:331
 cleanup_mnt+0x426/0x4c0 fs/namespace.c:1177
 task_work_run+0x24a/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297
 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f270e28d5d7
Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcd3a53d88 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f270e28d5d7
RDX: 00007ffcd3a53e59 RSI: 000000000000000a RDI: 00007ffcd3a53e50
RBP: 00007ffcd3a53e50 R08: 00000000ffffffff R09: 00007ffcd3a53c20
R10: 00005555563c8903 R11: 0000000000000246 R12: 00007f270e2e6cdc
R13: 00007ffcd3a54f10 R14: 00005555563c8810 R15: 00007ffcd3a54f50
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001f40c00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d030
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0000a79408 ffffea0000e42408 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 0x140cc0(GFP_USER|__GFP_COMP), pid 19692, tgid 19691 (syz-executor.2), ts 723994287298, free_ts 724068260010
 prep_new_page mm/page_alloc.c:2553 [inline]
 get_page_from_freelist+0x3246/0x33c0 mm/page_alloc.c:4326
 __alloc_pages+0x255/0x670 mm/page_alloc.c:5592
 __alloc_pages_node include/linux/gfp.h:237 [inline]
 alloc_pages_node include/linux/gfp.h:260 [inline]
 __kmalloc_large_node+0x91/0x1d0 mm/slab_common.c:1112
 kmalloc_large+0x20/0x100 mm/slab_common.c:1129
 kmalloc include/linux/slab.h:577 [inline]
 diMount+0x29/0x870 fs/jfs/jfs_imap.c:105
 jfs_mount+0x300/0x830 fs/jfs/jfs_mount.c:151
 jfs_fill_super+0x59c/0xc50 fs/jfs/super.c:556
 mount_bdev+0x271/0x3a0 fs/super.c:1380
 legacy_get_tree+0xef/0x190 fs/fs_context.c:610
 vfs_get_tree+0x8c/0x270 fs/super.c:1510
 do_new_mount+0x28f/0xae0 fs/namespace.c:3042
 do_mount fs/namespace.c:3385 [inline]
 __do_sys_mount fs/namespace.c:3594 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3571
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 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:1454 [inline]
 free_pcp_prepare mm/page_alloc.c:1504 [inline]
 free_unref_page_prepare+0xe2f/0xe70 mm/page_alloc.c:3388
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:3483
 free_large_kmalloc+0xff/0x190 mm/slab_common.c:944
 diUnmount+0xf3/0x100 fs/jfs/jfs_imap.c:195
 jfs_umount+0x186/0x3a0 fs/jfs/jfs_umount.c:63
 jfs_put_super+0x8a/0x190 fs/jfs/super.c:194
 generic_shutdown_super+0x134/0x340 fs/super.c:500
 kill_block_super+0x7e/0xe0 fs/super.c:1407
 deactivate_locked_super+0xa4/0x110 fs/super.c:331
 cleanup_mnt+0x426/0x4c0 fs/namespace.c:1177
 task_work_run+0x24a/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297
 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88807d02ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807d02ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807d030000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88807d030080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807d030100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/04/18 20:21 upstream af67688dca57 d931e9f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in diSync
2023/07/01 16:20 upstream a507db1d8fdc bfc47836 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in diSync
* Struck through repros no longer work on HEAD.