syzbot


KASAN: stack-out-of-bounds Read in ntfs_set_inode

Status: upstream: reported on 2023/04/18 20:27
Labels: ntfs3 (incorrect?)
Reported-by: syzbot+cbdd49fbb39696c71041@syzkaller.appspotmail.com
First crash: 75d, last: 19d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ntfs3?] KASAN: stack-out-of-bounds Read in ntfs_set_inode 0 (1) 2023/04/18 20:27
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in ntfs_set_inode 8 234d 237d 0/24 auto-obsoleted due to no activity on 2023/02/04 09:17

Sample crash report:
loop2: detected capacity change from 0 to 4096
==================================================================
BUG: KASAN: stack-out-of-bounds in ino_get fs/ntfs3/ntfs.h:193 [inline]
BUG: KASAN: stack-out-of-bounds in ntfs_set_inode+0x65/0x70 fs/ntfs3/inode.c:514
Read of size 4 at addr ffffc9000535fccf by task syz-executor.2/15033

CPU: 3 PID: 15033 Comm: syz-executor.2 Not tainted 6.4.0-rc1-syzkaller-00021-gad2fd53a7870 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
 print_report mm/kasan/report.c:462 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:572
 ino_get fs/ntfs3/ntfs.h:193 [inline]
 ntfs_set_inode+0x65/0x70 fs/ntfs3/inode.c:514
 inode_insert5+0x125/0x660 fs/inode.c:1187
 iget5_locked fs/inode.c:1245 [inline]
 iget5_locked+0x225/0x2c0 fs/inode.c:1234
 ntfs_iget5+0xd2/0x3670 fs/ntfs3/inode.c:523
 ntfs_fill_super+0x3196/0x3c20 fs/ntfs3/super.c:1272
 get_tree_bdev+0x44a/0x770 fs/super.c:1303
 vfs_get_tree+0x8d/0x350 fs/super.c:1510
 do_new_mount fs/namespace.c:3039 [inline]
 path_mount+0x134b/0x1e40 fs/namespace.c:3369
 do_mount fs/namespace.c:3382 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x283/0x300 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f242748d69a
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:00007f2428136f88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 000000000001f6bf RCX: 00007f242748d69a
RDX: 000000002001f6c0 RSI: 000000002001f700 RDI: 00007f2428136fe0
RBP: 00007f2428137020 R08: 00007f2428137020 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000002001f6c0
R13: 000000002001f700 R14: 00007f2428136fe0 R15: 000000002001f740
 </TASK>

The buggy address belongs to stack of task syz-executor.2/15033
 and is located at offset 127 in frame:
 ntfs_fill_super+0x0/0x3c20 fs/ntfs3/super.c:474

This frame has 5 objects:
 [48, 52) 'vcn'
 [64, 68) 'lcn'
 [80, 84) 'len'
 [96, 104) 'tt'
 [128, 136) 'ref'

The buggy address belongs to the virtual mapping at
 [ffffc90005358000, ffffc90005361000) created by:
 kernel_clone+0xeb/0x890 kernel/fork.c:2918

The buggy address belongs to the physical page:
page:ffffea0001c3f340 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x70fcd
memcg:ffff8880169e9502
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 04fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff8880169e9502
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 15011, tgid 15011 (syz-executor.2), ts 391195470314, free_ts 388796247992
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
 vm_area_alloc_pages mm/vmalloc.c:3009 [inline]
 __vmalloc_area_node mm/vmalloc.c:3085 [inline]
 __vmalloc_node_range+0xb1c/0x14a0 mm/vmalloc.c:3257
 alloc_thread_stack_node kernel/fork.c:313 [inline]
 dup_task_struct kernel/fork.c:1116 [inline]
 copy_process+0x13bb/0x7600 kernel/fork.c:2333
 kernel_clone+0xeb/0x890 kernel/fork.c:2918
 __do_sys_clone+0xba/0x100 kernel/fork.c:3061
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/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:1302 [inline]
 free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2564
 free_unref_page+0x33/0x370 mm/page_alloc.c:2659
 slab_destroy mm/slab.c:1612 [inline]
 slabs_destroy+0x85/0xc0 mm/slab.c:1632
 __cache_free_alien mm/slab.c:773 [inline]
 cache_free_alien mm/slab.c:789 [inline]
 ___cache_free+0x204/0x3d0 mm/slab.c:3416
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x4f/0x1a0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook mm/slab.h:711 [inline]
 slab_alloc_node mm/slab.c:3256 [inline]
 slab_alloc mm/slab.c:3265 [inline]
 __kmem_cache_alloc_lru mm/slab.c:3442 [inline]
 kmem_cache_alloc+0x1bd/0x3f0 mm/slab.c:3451
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:140
 getname_flags include/linux/audit.h:321 [inline]
 getname+0x92/0xd0 fs/namei.c:219
 do_sys_openat2+0xf5/0x4c0 fs/open.c:1350
 do_sys_open fs/open.c:1372 [inline]
 __do_sys_openat fs/open.c:1388 [inline]
 __se_sys_openat fs/open.c:1383 [inline]
 __x64_sys_openat+0x143/0x1f0 fs/open.c:1383
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffffc9000535fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc9000535fc00: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1
>ffffc9000535fc80: 04 f2 04 f2 04 f2 00 f2 f2 f2 00 f3 f3 f3 00 00
                                              ^
 ffffc9000535fd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc9000535fd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2023/05/10 21:08 upstream ad2fd53a7870 0fbd49f4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: stack-out-of-bounds Read in ntfs_set_inode
2023/04/13 11:08 upstream de4664485abb 82d5e53e .config console log report info ci-qemu-upstream KASAN: stack-out-of-bounds Read in ntfs_set_inode
2023/03/29 14:37 upstream fcd476ea6a88 f325deb0 .config console log report info ci-qemu-upstream KASAN: stack-out-of-bounds Read in ntfs_set_inode
2023/04/18 20:26 upstream af67688dca57 d931e9f0 .config console log report info ci-qemu-upstream-386 KASAN: stack-out-of-bounds Read in ntfs_set_inode
2023/04/05 20:33 upstream 99ddf2254feb 8b834965 .config console log report info ci-qemu-upstream-386 KASAN: stack-out-of-bounds Read in ntfs_set_inode
2023/03/16 05:10 upstream 9c1bec9c0b08 18b58603 .config console log report info ci-qemu-upstream-386 KASAN: stack-out-of-bounds Read in ntfs_set_inode
* Struck through repros no longer work on HEAD.