syzbot


KASAN: slab-out-of-bounds Read in ntfs_attr_find

Status: fixed on 2020/11/20 16:27
Reported-by: syzbot+bc53b9b58b7531ec0268@syzkaller.appspotmail.com
Fix commit: d2918cca649f ntfs: add check for mft record size in superblock
First crash: 1520d, last: 1492d
Fix bisection: fixed by (bisect log) :
commit d2918cca649f7457018f2c94176a8302e7a9f311
Author: Rustam Kovhaev <rkovhaev@gmail.com>
Date: Tue Oct 13 23:48:17 2020 +0000

  ntfs: add check for mft record size in superblock

  
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ntfs_attr_find ntfs3 C done 74 652d 818d 22/28 fixed on 2023/02/24 13:50
upstream KASAN: slab-out-of-bounds Read in ntfs_attr_find ntfs3 C done 9 1499d 2424d 15/28 fixed on 2020/11/16 12:12
linux-5.15 KASAN: slab-out-of-bounds Read in ntfs_attr_find 1 577d 577d 0/3 auto-obsoleted due to no activity on 2023/08/22 04:27
linux-4.14 KASAN: slab-out-of-bounds Read in ntfs_attr_find (2) C 31 633d 819d 0/1 upstream: reported C repro on 2022/08/25 11:21
linux-4.19 KASAN: slab-out-of-bounds Read in ntfs_attr_find C done 10 1459d 1516d 1/1 fixed on 2020/12/23 11:20

Sample crash report:
audit: type=1400 audit(1603061229.432:8): avc:  denied  { execmem } for  pid=6352 comm="syz-executor165" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
ntfs: (device loop0): is_boot_sector_ntfs(): Invalid end of sector marker.
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_attr_find+0x8df/0xa10 fs/ntfs/attrib.c:613
Read of size 4 at addr ffff88808774653f by task syz-executor165/6352

CPU: 1 PID: 6352 Comm: syz-executor165 Not tainted 4.14.198-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load_n_noabort+0x6b/0x80 mm/kasan/report.c:440
 ntfs_attr_find+0x8df/0xa10 fs/ntfs/attrib.c:613
 ntfs_attr_lookup+0xeca/0x1f30 fs/ntfs/attrib.c:1203
 ntfs_read_inode_mount+0x6b4/0x1fb0 fs/ntfs/inode.c:1867
 ntfs_fill_super+0x9a6/0x7170 fs/ntfs/super.c:2871
 mount_bdev+0x2b3/0x360 fs/super.c:1134
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0xe53/0x2a00 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3072
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x44c1fa
RSP: 002b:00007fff0c76c758 EFLAGS: 00000287 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff0c76c7b0 RCX: 000000000044c1fa
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fff0c76c770
RBP: 00007fff0c76c770 R08: 00007fff0c76c7b0 R09: 00007fff00000015
R10: 0000000000000000 R11: 0000000000000287 R12: 000000000000025d
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003

Allocated by task 3652:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x4c/0x70 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:530 [inline]
 kvmalloc_node+0x46/0xd0 mm/util.c:397
 kvmalloc include/linux/mm.h:531 [inline]
 seq_buf_alloc fs/seq_file.c:29 [inline]
 seq_read+0x882/0x1120 fs/seq_file.c:208
 __vfs_read+0xe4/0x620 fs/read_write.c:411
 vfs_read+0x139/0x340 fs/read_write.c:447
 SYSC_read fs/read_write.c:574 [inline]
 SyS_read+0xf2/0x210 fs/read_write.c:567
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 3652:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 kvfree+0x45/0x50 mm/util.c:416
 seq_release fs/seq_file.c:368 [inline]
 single_release+0x75/0xb0 fs/seq_file.c:605
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff888087746e80
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2369 bytes to the left of
 4096-byte region [ffff888087746e80, ffff888087747e80)
The buggy address belongs to the page:
page:ffffea00021dd180 count:1 mapcount:0 mapping:ffff888087746e80 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff888087746e80 0000000000000000 0000000100000001
raw: ffffea00021c0120 ffffea00021dd620 ffff88812fe50dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888087746400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888087746480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888087746500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff888087746580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888087746600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/10/18 23:21 linux-4.14.y cbfa1702aaf6 fea47c01 .config console log report syz C ci2-linux-4-14
2020/10/12 10:52 linux-4.14.y cbfa1702aaf6 4a77ae0b .config console log report syz C ci2-linux-4-14
2020/10/10 03:21 linux-4.14.y cbfa1702aaf6 93817d89 .config console log report syz C ci2-linux-4-14
2020/10/10 02:25 linux-4.14.y cbfa1702aaf6 93817d89 .config console log report syz C ci2-linux-4-14
2020/09/30 11:58 linux-4.14.y cbfa1702aaf6 8516f6d3 .config console log report syz C ci2-linux-4-14
2020/09/23 12:13 linux-4.14.y cbfa1702aaf6 287cd75a .config console log report syz C ci2-linux-4-14
2020/10/21 07:10 linux-4.14.y cbfa1702aaf6 ff4a3345 .config console log report info ci2-linux-4-14
2020/10/13 22:26 linux-4.14.y cbfa1702aaf6 fc7735a2 .config console log report info ci2-linux-4-14
2020/09/26 12:16 linux-4.14.y cbfa1702aaf6 2d5ea0cb .config console log report info ci2-linux-4-14
2020/09/25 00:57 linux-4.14.y cbfa1702aaf6 54289b08 .config console log report info ci2-linux-4-14
* Struck through repros no longer work on HEAD.