syzbot


KASAN: stack-out-of-bounds Write in ntfs_get_ea

Status: moderation: reported on 2024/08/25 00:13
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+2ab1e9ec3e1d6e848aec@syzkaller.appspotmail.com
First crash: 25d, last: 25d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in ntfs_get_ea ntfs3 C error done 9 671d 739d 22/28 fixed on 2023/04/12 21:18

Sample crash report:
loop0: detected capacity change from 0 to 2048
FAT-fs (loop0): bogus number of reserved sectors
FAT-fs (loop0): Can't find a valid FAT filesystem
loop0: detected capacity change from 0 to 4096
ntfs3: loop0: Different NTFS sector size (2048) and media sector size (512).
process 'syz.0.0' launched './file1' with NULL argv: empty string added
==================================================================
BUG: KASAN: stack-out-of-bounds in stack_trace_consume_entry+0x108/0x280 kernel/stacktrace.c:93
Write of size 8 at addr ffffc90002def358 by task syz.0.0/5115

CPU: 0 UID: 0 PID: 5115 Comm: syz.0.0 Not tainted 6.11.0-rc4-syzkaller-00008-g6e4436539ae1 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 stack_trace_consume_entry+0x108/0x280 kernel/stacktrace.c:93
 arch_stack_walk+0x143/0x1b0 arch/x86/kernel/stacktrace.c:27
 stack_trace_save+0x118/0x1d0 kernel/stacktrace.c:122
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240
 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2252 [inline]
 slab_free mm/slub.c:4473 [inline]
 kfree+0x149/0x360 mm/slub.c:4594
 ntfs_get_ea+0x215/0x690 fs/ntfs3/xattr.c:306
 ntfs_getxattr+0x1c5/0x6f0 fs/ntfs3/xattr.c:827
 vfs_getxattr_alloc+0x472/0x5c0 fs/xattr.c:393
 ima_read_xattr+0x38/0x60 security/integrity/ima/ima_appraise.c:229
 process_measurement+0x1180/0x1fb0 security/integrity/ima/ima_main.c:353
 ima_bprm_check+0x129/0x2b0 security/integrity/ima/ima_main.c:547
 security_bprm_check+0x65/0x90 security/security.c:1191
 search_binary_handler fs/exec.c:1815 [inline]
 exec_binprm fs/exec.c:1869 [inline]
 bprm_execve+0xa56/0x1770 fs/exec.c:1920
 do_execveat_common+0x55f/0x6f0 fs/exec.c:2027
 do_execveat fs/exec.c:2112 [inline]
 __do_sys_execveat fs/exec.c:2186 [inline]
 __se_sys_execveat fs/exec.c:2180 [inline]
 __x64_sys_execveat+0xc4/0xe0 fs/exec.c:2180
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f05b5979e79
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f05b66b1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000142
RAX: ffffffffffffffda RBX: 00007f05b5b15f80 RCX: 00007f05b5979e79
RDX: 0000000000000000 RSI: 0000000020000480 RDI: ffffffffffffff9c
RBP: 00007f05b59e7916 R08: 0000000000001000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f05b5b15f80 R15: 00007ffe9fefc6e8
 </TASK>

The buggy address belongs to stack of task syz.0.0/5115
 and is located at offset 280 in frame:
 stack_trace_save+0x0/0x1d0 kernel/stacktrace.c:52

This frame has 1 object:
 [32, 56) 'c'

The buggy address belongs to the virtual mapping at
 [ffffc90002de8000, ffffc90002df1000) created by:
 copy_process+0x5d1/0x3e10 kernel/fork.c:2217

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801b75c000 pfn:0x1b75c
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: ffff88801b75c000 0000000000000000 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 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 5114, tgid 5114 (syz.0.0), ts 87862654391, free_ts 87112055340
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1493
 prep_new_page mm/page_alloc.c:1501 [inline]
 get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3439
 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4695
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2263
 vm_area_alloc_pages mm/vmalloc.c:3584 [inline]
 __vmalloc_area_node mm/vmalloc.c:3653 [inline]
 __vmalloc_node_range_noprof+0xa40/0x1400 mm/vmalloc.c:3834
 alloc_thread_stack_node kernel/fork.c:313 [inline]
 dup_task_struct+0x444/0x8c0 kernel/fork.c:1113
 copy_process+0x5d1/0x3e10 kernel/fork.c:2217
 kernel_clone+0x226/0x8f0 kernel/fork.c:2800
 __do_sys_clone3 kernel/fork.c:3104 [inline]
 __se_sys_clone3+0x2cb/0x350 kernel/fork.c:3083
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 5109 tgid 5109 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1094 [inline]
 free_unref_page+0xd22/0xea0 mm/page_alloc.c:2612
 __slab_free+0x31b/0x3d0 mm/slub.c:4384
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3988 [inline]
 slab_alloc_node mm/slub.c:4037 [inline]
 kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4044
 getname_flags+0xb7/0x540 fs/namei.c:139
 do_sys_openat2+0xd2/0x1d0 fs/open.c:1410
 do_sys_open fs/open.c:1431 [inline]
 __do_sys_openat fs/open.c:1447 [inline]
 __se_sys_openat fs/open.c:1442 [inline]
 __x64_sys_openat+0x247/0x2a0 fs/open.c:1442
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffffc90002def200: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 f3
 ffffc90002def280: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90002def300: 00 00 00 00 00 00 00 00 00 00 00 f3 00 00 00 00
                                                    ^
 ffffc90002def380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90002def400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/20 18:43 upstream 6e4436539ae1 9f0ab3fb .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: stack-out-of-bounds Write in ntfs_get_ea
* Struck through repros no longer work on HEAD.