syzbot


KASAN: slab-out-of-bounds Read in ntfs_iget5
Status: upstream: reported on 2022/04/22 13:07
Reported-by: syzbot+b4084c18420f9fad0b4f@syzkaller.appspotmail.com
First crash: 35d, last: 3d20h
similar bugs (5):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: uninit-value in udf_evict_inode (2) 13 112d 165d 22/22 fixed on 2022/03/08 16:11
upstream KMSAN: uninit-value in ext4_inode_journal_mode (2) 115 2d17h 140d 0/22 upstream: reported on 2022/01/07 15:40
upstream KMSAN: uninit-value in nf_nat_setup_info (2) C 764 60d 140d 0/22 upstream: reported C repro on 2022/01/07 16:51
upstream KASAN: use-after-free Read in ntfs_test_inode 35 2d03h 375d 0/22 upstream: reported on 2021/05/17 10:56
upstream KMSAN: uninit-value in native_apic_mem_write 2 536d 564d 0/22 auto-closed as invalid on 2021/03/07 18:48

Sample crash report:
ntfs3: loop5: Different NTFS' sector size (1024) and media sector size (512)
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_iget5+0x151/0x36c0 fs/ntfs3/inode.c:501
Read of size 8 at addr ffff88804367ff60 by task syz-executor.5/17448

CPU: 1 PID: 17448 Comm: syz-executor.5 Not tainted 5.18.0-rc7-syzkaller-00181-geaea45fc0e7b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x65/0x4b0 mm/kasan/report.c:313
 print_report+0xf4/0x210 mm/kasan/report.c:429
 kasan_report+0xfb/0x130 mm/kasan/report.c:491
 ntfs_iget5+0x151/0x36c0 fs/ntfs3/inode.c:501
 ntfs_fill_super+0x2285/0x4250 fs/ntfs3/super.c:997
 get_tree_bdev+0x400/0x620 fs/super.c:1292
 vfs_get_tree+0x88/0x270 fs/super.c:1497
 do_new_mount+0x289/0xad0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2e3/0x3d0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fd6d4e8a61a
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd6d5efff88 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 00007fd6d4e8a61a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fd6d5efffe0
RBP: 00007fd6d5f00020 R08: 00007fd6d5f00020 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000020000000
R13: 0000000020000100 R14: 00007fd6d5efffe0 R15: 000000002007aa80
 </TASK>

Allocated by task 17370:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:469
 kasan_slab_alloc include/linux/kasan.h:224 [inline]
 slab_post_alloc_hook mm/slab.h:749 [inline]
 slab_alloc_node mm/slub.c:3217 [inline]
 slab_alloc mm/slub.c:3225 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3232 [inline]
 kmem_cache_alloc+0x199/0x2f0 mm/slub.c:3242
 radix_tree_node_alloc+0x192/0x3b0 lib/radix-tree.c:251
 __radix_tree_create lib/radix-tree.c:622 [inline]
 radix_tree_insert+0x21a/0x670 lib/radix-tree.c:710
 __insert_free_nid fs/f2fs/node.c:2184 [inline]
 add_free_nid+0x312/0x9a0 fs/f2fs/node.c:2330
 scan_nat_page fs/f2fs/node.c:2386 [inline]
 __f2fs_build_free_nids fs/f2fs/node.c:2492 [inline]
 f2fs_build_free_nids+0xbec/0x11d0 fs/f2fs/node.c:2530
 f2fs_fill_super+0x5fa1/0x84c0 fs/f2fs/super.c:4210
 mount_bdev+0x26c/0x3a0 fs/super.c:1367
 legacy_get_tree+0xea/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1497
 do_new_mount+0x289/0xad0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2e3/0x3d0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
 call_rcu+0x163/0x9c0 kernel/rcu/tree.c:3074
 radix_tree_node_free lib/radix-tree.c:308 [inline]
 delete_node+0x1bc/0x790 lib/radix-tree.c:571
 radix_tree_delete_item+0x2e5/0x3e0 lib/radix-tree.c:1429
 __remove_free_nid fs/f2fs/node.c:2203 [inline]
 f2fs_destroy_node_manager+0x329/0xf10 fs/f2fs/node.c:3333
 f2fs_put_super+0x6c5/0xc10 fs/f2fs/super.c:1578
 generic_shutdown_super+0x128/0x300 fs/super.c:462
 kill_block_super+0x79/0xd0 fs/super.c:1394
 kill_f2fs_super+0x2f9/0x3c0 fs/f2fs/super.c:4516
 deactivate_locked_super+0xa7/0xf0 fs/super.c:332
 cleanup_mnt+0x452/0x500 fs/namespace.c:1186
 task_work_run+0x146/0x1c0 kernel/task_work.c:164
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x134/0x160 kernel/entry/common.c:169
 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
 call_rcu+0x163/0x9c0 kernel/rcu/tree.c:3074
 xa_node_free lib/xarray.c:260 [inline]
 xas_delete_node lib/xarray.c:496 [inline]
 update_node lib/xarray.c:760 [inline]
 xas_store+0x1069/0x19d0 lib/xarray.c:845
 page_cache_delete+0x8d9/0xad0 mm/filemap.c:140
 __filemap_remove_folio mm/filemap.c:223 [inline]
 filemap_remove_folio+0x13f/0x310 mm/filemap.c:255
 truncate_inode_folio+0x59/0x70 mm/truncate.c:196
 shmem_undo_range+0x6d4/0x2350 mm/shmem.c:952
 shmem_truncate_range mm/shmem.c:1044 [inline]
 shmem_evict_inode+0x267/0xa90 mm/shmem.c:1133
 evict+0x2a4/0x620 fs/inode.c:664
 __dentry_kill+0x3b1/0x5b0 fs/dcache.c:607
 dentry_kill+0xbb/0x290
 dput+0x1f3/0x410 fs/dcache.c:913
 __fput+0x5a8/0x820 fs/file_table.c:330
 task_work_run+0x146/0x1c0 kernel/task_work.c:164
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x134/0x160 kernel/entry/common.c:169
 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88804367fc80
 which belongs to the cache radix_tree_node of size 576
The buggy address is located 160 bytes to the right of
 576-byte region [ffff88804367fc80, ffff88804367fec0)

The buggy address belongs to the physical page:
page:ffffea00010d9f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88804367cb00 pfn:0x4367c
head:ffffea00010d9f00 order:2 compound_mapcount:0 compound_pincount:0
memcg:ffff88804c746f01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00010db608 ffffea0001784108 ffff88801144fc80
raw: ffff88804367cb00 0000000000170002 00000001ffffffff ffff88804c746f01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x152a30(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 16456, tgid 16448 (syz-executor.5), ts 2086952044163, free_ts 1120143942125
 prep_new_page mm/page_alloc.c:2441 [inline]
 get_page_from_freelist+0x72e/0x7a0 mm/page_alloc.c:4182
 __alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5408
 alloc_slab_page+0x70/0xf0 mm/slub.c:1799
 allocate_slab+0x5e/0x560 mm/slub.c:1944
 new_slab mm/slub.c:2004 [inline]
 ___slab_alloc+0x41e/0xcd0 mm/slub.c:3005
 __slab_alloc mm/slub.c:3092 [inline]
 slab_alloc_node mm/slub.c:3183 [inline]
 slab_alloc mm/slub.c:3225 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3232 [inline]
 kmem_cache_alloc+0x246/0x2f0 mm/slub.c:3242
 radix_tree_node_alloc+0x192/0x3b0 lib/radix-tree.c:251
 idr_get_free+0x2f7/0xb30 lib/radix-tree.c:1505
 idr_alloc_u32 lib/idr.c:46 [inline]
 idr_alloc_cyclic+0x1f3/0x5e0 lib/idr.c:125
 __kernfs_new_node+0x124/0x730 fs/kernfs/dir.c:591
 kernfs_new_node+0x95/0x160 fs/kernfs/dir.c:647
 __kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:982
 sysfs_add_file_mode_ns+0x21d/0x330 fs/sysfs/file.c:294
 create_files fs/sysfs/group.c:64 [inline]
 internal_create_group+0x55c/0xf50 fs/sysfs/group.c:148
 internal_create_groups fs/sysfs/group.c:188 [inline]
 sysfs_create_groups+0x5d/0x130 fs/sysfs/group.c:214
 create_dir lib/kobject.c:68 [inline]
 kobject_add_internal+0x723/0xd10 lib/kobject.c:223
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1356 [inline]
 free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1406
 free_unref_page_prepare mm/page_alloc.c:3328 [inline]
 free_unref_page+0x7d/0x390 mm/page_alloc.c:3423
 do_slab_free mm/slub.c:3498 [inline]
 ___cache_free+0x118/0x1a0 mm/slub.c:3517
 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:446
 kasan_slab_alloc include/linux/kasan.h:224 [inline]
 slab_post_alloc_hook mm/slab.h:749 [inline]
 slab_alloc_node mm/slub.c:3217 [inline]
 slab_alloc mm/slub.c:3225 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3232 [inline]
 kmem_cache_alloc+0x199/0x2f0 mm/slub.c:3242
 kmem_cache_zalloc include/linux/slab.h:704 [inline]
 jbd2_alloc_handle include/linux/jbd2.h:1597 [inline]
 new_handle fs/jbd2/transaction.c:476 [inline]
 jbd2__journal_start+0x143/0x5b0 fs/jbd2/transaction.c:503
 __ext4_journal_start_sb+0x111/0x1d0 fs/ext4/ext4_jbd2.c:105
 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline]
 ext4_evict_inode+0x89b/0xf90 fs/ext4/inode.c:251
 evict+0x2a4/0x620 fs/inode.c:664
 __dentry_kill+0x3b1/0x5b0 fs/dcache.c:607
 dentry_kill+0xbb/0x290
 dput+0x1f3/0x410 fs/dcache.c:913
 __fput+0x5a8/0x820 fs/file_table.c:330
 task_work_run+0x146/0x1c0 kernel/task_work.c:164

Memory state around the buggy address:
 ffff88804367fe00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804367fe80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88804367ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                       ^
 ffff88804367ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888043680000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (7):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2022/05/22 12:40 upstream eaea45fc0e7b 7268fa62 .config log report info KASAN: slab-out-of-bounds Read in ntfs_iget5
ci-upstream-kasan-gce-root 2022/04/22 12:17 upstream d569e86915b7 2738b391 .config log report info KASAN: slab-out-of-bounds Read in ntfs_iget5
ci-upstream-kasan-gce-smack-root 2022/05/13 09:48 upstream f3f19f939c11 9ad6612a .config log report info KASAN: use-after-free Read in ntfs_iget5
ci-upstream-kmsan-gce 2022/05/24 08:23 https://github.com/google/kmsan.git master c5c93da9af13 e7f9308d .config log report info KMSAN: uninit-value in native_apic_mem_write
ci-upstream-linux-next-kasan-gce-root 2022/05/11 00:12 linux-next 38a288f5941e 8d7b3b67 .config log report info KASAN: use-after-free Read in ntfs_iget5
ci-upstream-kmsan-gce-386 2022/05/13 15:02 https://github.com/google/kmsan.git master d6e2c8c7eb40 107f6434 .config log report info KMSAN: uninit-value in ntfs_iget5
ci-upstream-kmsan-gce-386 2022/04/27 05:48 https://github.com/google/kmsan.git master d6e2c8c7eb40 1fa34c1b .config log report info KMSAN: uninit-value in ntfs_iget5