syzbot


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

Status: moderation: reported on 2023/09/28 23:15
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+205e853d6f003086d5e0@syzkaller.appspotmail.com
First crash: 78d, last: 78d

Sample crash report:
loop3: detected capacity change from 0 to 4096
ntfs3: loop3: Different NTFS sector size (1024) and media sector size (512).
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_fix_post_read+0x298/0x2c0 fs/ntfs3/fsntfs.c:193
Read of size 2 at addr ffff8880194b33fe by task syz-executor.3/1435

CPU: 2 PID: 1435 Comm: syz-executor.3 Not tainted 6.6.0-rc3-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 ntfs_fix_post_read+0x298/0x2c0 fs/ntfs3/fsntfs.c:193
 ntfs_read_bh+0x93/0xa0 fs/ntfs3/fsntfs.c:1299
 mi_read+0x1e7/0x650 fs/ntfs3/record.c:133
 ntfs_read_mft fs/ntfs3/inode.c:70 [inline]
 ntfs_iget5+0x4ee/0x3960 fs/ntfs3/inode.c:532
 ntfs_fill_super+0x3587/0x4330 fs/ntfs3/super.c:1423
 get_tree_bdev+0x3b5/0x650 fs/super.c:1577
 vfs_get_tree+0x8c/0x370 fs/super.c:1750
 do_new_mount fs/namespace.c:3335 [inline]
 path_mount+0x1492/0x1ed0 fs/namespace.c:3662
 do_mount fs/namespace.c:3675 [inline]
 __do_sys_mount fs/namespace.c:3884 [inline]
 __se_sys_mount fs/namespace.c:3861 [inline]
 __ia32_sys_mount+0x291/0x310 fs/namespace.c:3861
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82
RIP: 0023:0xf7fb0579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f7fab3f0 EFLAGS: 00000296 ORIG_RAX: 0000000000000015
RAX: ffffffffffffffda RBX: 00000000f7fab460 RCX: 000000002001f740
RDX: 000000002001f700 RSI: 0000000000000000 RDI: 00000000f7fab4a0
RBP: 000000002001f700 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 1435:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:198 [inline]
 __do_kmalloc_node mm/slab_common.c:1023 [inline]
 __kmalloc+0x60/0x100 mm/slab_common.c:1036
 kmalloc include/linux/slab.h:603 [inline]
 mi_init+0x90/0xf0 fs/ntfs3/record.c:105
 ntfs_read_mft fs/ntfs3/inode.c:54 [inline]
 ntfs_iget5+0x462/0x3960 fs/ntfs3/inode.c:532
 ntfs_fill_super+0x3587/0x4330 fs/ntfs3/super.c:1423
 get_tree_bdev+0x3b5/0x650 fs/super.c:1577
 vfs_get_tree+0x8c/0x370 fs/super.c:1750
 do_new_mount fs/namespace.c:3335 [inline]
 path_mount+0x1492/0x1ed0 fs/namespace.c:3662
 do_mount fs/namespace.c:3675 [inline]
 __do_sys_mount fs/namespace.c:3884 [inline]
 __se_sys_mount fs/namespace.c:3861 [inline]
 __ia32_sys_mount+0x291/0x310 fs/namespace.c:3861
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82

Last potentially related work creation:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492
 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372
 neigh_destroy+0x435/0x670 net/core/neighbour.c:910
 neigh_release include/net/neighbour.h:445 [inline]
 neigh_cleanup_and_release+0x1fe/0x280 net/core/neighbour.c:103
 neigh_periodic_work+0x672/0xb60 net/core/neighbour.c:994
 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
 process_scheduled_works kernel/workqueue.c:2703 [inline]
 worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
 kthread+0x33c/0x440 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304

The buggy address belongs to the object at ffff8880194b3000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 1022 bytes inside of
 allocated 1023-byte region [ffff8880194b3000, ffff8880194b33ff)

The buggy address belongs to the physical page:
page:ffffea0000652c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x194b0
head:ffffea0000652c00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888012c42dc0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 9619, tgid 9613 (syz-executor.1), ts 241654263574, free_ts 240923045149
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536
 prep_new_page mm/page_alloc.c:1543 [inline]
 get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170
 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426
 __alloc_pages_node include/linux/gfp.h:237 [inline]
 alloc_slab_page mm/slub.c:1872 [inline]
 allocate_slab+0xa1/0x380 mm/slub.c:2017
 new_slab mm/slub.c:2070 [inline]
 ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
 __slab_alloc_node mm/slub.c:3375 [inline]
 slab_alloc_node mm/slub.c:3468 [inline]
 __kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517
 kmalloc_node_trace+0x22/0xd0 mm/slab_common.c:1127
 kmalloc_node include/linux/slab.h:615 [inline]
 kzalloc_node include/linux/slab.h:731 [inline]
 sbitmap_queue_init_node+0x32d/0x550 lib/sbitmap.c:433
 bt_alloc block/blk-mq-tag.c:542 [inline]
 blk_mq_init_bitmaps+0x59/0x170 block/blk-mq-tag.c:554
 blk_mq_init_tags+0x10b/0x180 block/blk-mq-tag.c:585
 blk_mq_alloc_rq_map block/blk-mq.c:3334 [inline]
 blk_mq_alloc_map_and_rqs+0x22b/0xec0 block/blk-mq.c:3787
 __blk_mq_alloc_map_and_rqs block/blk-mq.c:3809 [inline]
 __blk_mq_alloc_map_and_rqs+0x124/0x1f0 block/blk-mq.c:3800
 __blk_mq_alloc_rq_maps block/blk-mq.c:4311 [inline]
 blk_mq_alloc_set_map_and_rqs block/blk-mq.c:4342 [inline]
 blk_mq_alloc_tag_set+0x8d5/0x1320 block/blk-mq.c:4516
 loop_add+0x33f/0xaf0 drivers/block/loop.c:2030
 loop_control_ioctl+0x13a/0x630 drivers/block/loop.c:2210
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1136 [inline]
 free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312
 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook mm/slab.h:762 [inline]
 slab_alloc_node mm/slub.c:3478 [inline]
 slab_alloc mm/slub.c:3486 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3493 [inline]
 kmem_cache_alloc+0x16c/0x3b0 mm/slub.c:3502
 getname_flags.part.0+0x50/0x4d0 fs/namei.c:140
 getname_flags include/linux/audit.h:321 [inline]
 getname+0x90/0xe0 fs/namei.c:219
 do_sys_openat2+0x100/0x1e0 fs/open.c:1416
 do_sys_open fs/open.c:1437 [inline]
 __do_compat_sys_openat fs/open.c:1497 [inline]
 __se_compat_sys_openat fs/open.c:1495 [inline]
 __ia32_compat_sys_openat+0x16e/0x200 fs/open.c:1495
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82

Memory state around the buggy address:
 ffff8880194b3280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880194b3300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880194b3380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07
                                                                ^
 ffff8880194b3400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880194b3480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	10 06                	adc    %al,(%rsi)
   2:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
   6:	10 07                	adc    %al,(%rdi)
   8:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
   c:	10 08                	adc    %cl,(%rax)
   e:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1e:	00 51 52             	add    %dl,0x52(%rcx)
  21:	55                   	push   %rbp
  22:	89 e5                	mov    %esp,%ebp
  24:	0f 34                	sysenter
  26:	cd 80                	int    $0x80
* 28:	5d                   	pop    %rbp <-- trapping instruction
  29:	5a                   	pop    %rdx
  2a:	59                   	pop    %rcx
  2b:	c3                   	ret
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  37:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/24 23:10 upstream 6465e260f487 0b6a67ac .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-out-of-bounds Read in ntfs_fix_post_read
* Struck through repros no longer work on HEAD.