syzbot


KASAN: slab-out-of-bounds Write in ntfs_set_ea

Status: upstream: reported C repro on 2024/11/17 01:18
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+09cb867ecb33ece66d64@syzkaller.appspotmail.com
First crash: 4d19h, last: 4d14h
Bug presence (2)
Date Name Commit Repro Result
2024/11/18 linux-6.1.y (ToT) b67dc5c9ade9 C [report] KASAN: slab-out-of-bounds Read in ntfs_sb_write
2024/11/18 upstream (ToT) adc218676eef C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Write in ntfs_set_ea 2 117d 117d 0/3 auto-obsoleted due to no activity on 2024/11/04 19:09
upstream KASAN: out-of-bounds Read in ntfs_set_ea ntfs3 C error done 4 702d 704d 22/28 fixed on 2023/02/24 13:50

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_set_ea+0x1394/0x1660 fs/ntfs3/xattr.c:411
Write of size 4 at addr ffff888027d2f71c by task syz-executor527/4254

CPU: 1 PID: 4254 Comm: syz-executor527 Not tainted 6.1.117-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 ntfs_set_ea+0x1394/0x1660 fs/ntfs3/xattr.c:411
 ntfs_save_wsl_perm+0x139/0x490 fs/ntfs3/xattr.c:976
 ntfs3_setattr+0x961/0xb70 fs/ntfs3/file.c:816
 notify_change+0xce3/0xfc0 fs/attr.c:499
 chmod_common+0x2a7/0x4b0 fs/open.c:606
 do_fchmodat fs/open.c:645 [inline]
 __do_sys_fchmodat fs/open.c:658 [inline]
 __se_sys_fchmodat fs/open.c:655 [inline]
 __x64_sys_fchmodat+0x117/0x1a0 fs/open.c:655
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fd767ffa1e9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 1f 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd767789168 EFLAGS: 00000246 ORIG_RAX: 000000000000010c
RAX: ffffffffffffffda RBX: 00007fd76809b6f8 RCX: 00007fd767ffa1e9
RDX: 0000000000000141 RSI: 0000000020000200 RDI: 00000000ffffff9c
RBP: 00007fd76809b6f0 R08: 00007ffe7722bd17 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd76809b6fc
R13: 000000000000006e R14: 00007ffe7722bc30 R15: 00007ffe7722bd18
 </TASK>

Allocated by task 1:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:683 [inline]
 __kernfs_new_node+0xd4/0x870 fs/kernfs/dir.c:614
 kernfs_new_node+0x136/0x230 fs/kernfs/dir.c:690
 __kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:1049
 sysfs_add_file_mode_ns+0x246/0x300 fs/sysfs/file.c:294
 sysfs_create_file_ns+0x193/0x2a0 fs/sysfs/file.c:355
 usb_add_hcd+0x9e2/0x1250 drivers/usb/core/hcd.c:2976
 dummy_hcd_probe+0x154/0x2a0 drivers/usb/gadget/udc/dummy_hcd.c:2695
 platform_probe+0x131/0x1b0 drivers/base/platform.c:1400
 really_probe+0x2ab/0xcb0 drivers/base/dd.c:639
 __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:785
 driver_probe_device+0x50/0x420 drivers/base/dd.c:815
 __device_attach_driver+0x2cf/0x510 drivers/base/dd.c:943
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:429
 __device_attach+0x359/0x570 drivers/base/dd.c:1015
 bus_probe_device+0xba/0x1e0 drivers/base/bus.c:489
 device_add+0xb48/0xfd0 drivers/base/core.c:3689
 platform_device_add+0x46e/0x7d0 drivers/base/platform.c:717
 dummy_hcd_init+0x83b/0x1069 drivers/usb/gadget/udc/dummy_hcd.c:2848
 do_one_initcall+0x265/0x8f0 init/main.c:1298
 do_initcall_level+0x157/0x207 init/main.c:1371
 do_initcalls+0x49/0x86 init/main.c:1387
 kernel_init_freeable+0x45c/0x60f init/main.c:1626
 kernel_init+0x19/0x290 init/main.c:1514
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888027d2f658
 which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 28 bytes to the right of
 168-byte region [ffff888027d2f658, ffff888027d2f700)

The buggy address belongs to the physical page:
page:ffffea00009f4bc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x27d2f
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888140009c80
raw: 0000000000000000 0000000000110011 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 10685540547, free_ts 10682585233
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
 prep_new_page mm/page_alloc.c:2524 [inline]
 get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4313
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5589
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2115
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:683 [inline]
 __kernfs_new_node+0xd4/0x870 fs/kernfs/dir.c:614
 kernfs_new_node+0x136/0x230 fs/kernfs/dir.c:690
 __kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:1049
 sysfs_add_file_mode_ns+0x246/0x300 fs/sysfs/file.c:294
 sysfs_merge_group+0x1f9/0x440 fs/sysfs/group.c:342
 dpm_sysfs_add+0xcf/0x270 drivers/base/power/sysfs.c:707
 device_add+0x702/0xfd0 drivers/base/core.c:3646
 device_create_groups_vargs drivers/base/core.c:4383 [inline]
 device_create+0x253/0x2e0 drivers/base/core.c:4425
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1444 [inline]
 free_pcp_prepare mm/page_alloc.c:1494 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464
 mm_free_pgd kernel/fork.c:742 [inline]
 __mmdrop+0xb2/0x470 kernel/fork.c:793
 free_bprm+0x135/0x2f0 fs/exec.c:1494
 kernel_execve+0x8f1/0xa10 fs/exec.c:2018
 call_usermodehelper_exec_async+0x22f/0x370 kernel/umh.c:113
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff888027d2f600: 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 00
 ffff888027d2f680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888027d2f700: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
                            ^
 ffff888027d2f780: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
 ffff888027d2f800: fc fc fc fc fc 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/17 06:22 linux-6.1.y 59d7b1a7104a cfe3a04a .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in ntfs_set_ea
2024/11/17 04:39 linux-6.1.y 59d7b1a7104a cfe3a04a .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in ntfs_set_ea
2024/11/17 03:48 linux-6.1.y 59d7b1a7104a cfe3a04a .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in ntfs_set_ea
2024/11/17 01:17 linux-6.1.y 59d7b1a7104a cfe3a04a .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in ntfs_set_ea
2024/11/17 03:11 linux-6.1.y 59d7b1a7104a cfe3a04a .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: use-after-free Write in ntfs_set_ea
* Struck through repros no longer work on HEAD.