syzbot


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

Status: upstream: reported C repro on 2022/09/06 16:55
Reported-by: syzbot+c4d950787fd5553287b7@syzkaller.appspotmail.com
First crash: 84d, last: 13d

Cause bisection: failed (bisect log)
Patch testing requests:
Created Duration User Patch Repo Result
2022/09/28 07:53 16m eadavis@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git e47eb90a0a9a OK log
2022/09/28 06:29 5m eadavis@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git e47eb90a0a9a error
2022/09/28 06:04 5m eadavis@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git e47eb90a0a9a error

Sample crash report:
ntfs3: loop0: failed to read volume at offset 0x123000
ntfs3: loop0: Failed to load $Extend.
==================================================================
BUG: KASAN: slab-out-of-bounds in unpacked_ea_size fs/ntfs3/xattr.c:26 [inline]
BUG: KASAN: slab-out-of-bounds in find_ea fs/ntfs3/xattr.c:54 [inline]
BUG: KASAN: slab-out-of-bounds in ntfs_get_ea+0x481/0x6b0 fs/ntfs3/xattr.c:230
Read of size 1 at addr ffff88801da239bd by task syz-executor201/3611

CPU: 0 PID: 3611 Comm: syz-executor201 Not tainted 6.1.0-rc4-syzkaller-00362-gfef7fd48922d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x74/0x340 mm/kasan/report.c:284
 print_report+0x107/0x220 mm/kasan/report.c:395
 kasan_report+0x139/0x170 mm/kasan/report.c:495
 unpacked_ea_size fs/ntfs3/xattr.c:26 [inline]
 find_ea fs/ntfs3/xattr.c:54 [inline]
 ntfs_get_ea+0x481/0x6b0 fs/ntfs3/xattr.c:230
 ntfs_get_wsl_perm+0x113/0x4b0 fs/ntfs3/xattr.c:973
 ntfs_read_mft fs/ntfs3/inode.c:355 [inline]
 ntfs_iget5+0x1b36/0x36f0 fs/ntfs3/inode.c:501
 dir_search_u+0x2f4/0x390 fs/ntfs3/dir.c:264
 ntfs_lookup+0x112/0x1b0 fs/ntfs3/namei.c:83
 __lookup_slow+0x286/0x3e0 fs/namei.c:1685
 lookup_slow+0x53/0x70 fs/namei.c:1702
 walk_component+0x2e1/0x410 fs/namei.c:1993
 lookup_last fs/namei.c:2450 [inline]
 path_lookupat+0x17d/0x450 fs/namei.c:2474
 filename_lookup+0x285/0x660 fs/namei.c:2503
 vfs_statx+0x121/0x4e0 fs/stat.c:229
 do_statx fs/stat.c:643 [inline]
 __do_sys_statx fs/stat.c:670 [inline]
 __se_sys_statx fs/stat.c:661 [inline]
 __x64_sys_statx+0x1a1/0x230 fs/stat.c:661
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fb7801b7169
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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe4e7544e8 EFLAGS: 00000246 ORIG_RAX: 000000000000014c
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb7801b7169
RDX: 0000000000000000 RSI: 0000000020003c40 RDI: 0000000000000005
RBP: 00007fb780176960 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000080 R11: 0000000000000246 R12: 00007fb7801769f0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 3611:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:380
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc+0xaf/0x1a0 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 ntfs_read_ea+0x437/0x820 fs/ntfs3/xattr.c:110
 ntfs_get_ea+0x1ad/0x6b0 fs/ntfs3/xattr.c:222
 ntfs_get_wsl_perm+0x113/0x4b0 fs/ntfs3/xattr.c:973
 ntfs_read_mft fs/ntfs3/inode.c:355 [inline]
 ntfs_iget5+0x1b36/0x36f0 fs/ntfs3/inode.c:501
 dir_search_u+0x2f4/0x390 fs/ntfs3/dir.c:264
 ntfs_lookup+0x112/0x1b0 fs/ntfs3/namei.c:83
 __lookup_slow+0x286/0x3e0 fs/namei.c:1685
 lookup_slow+0x53/0x70 fs/namei.c:1702
 walk_component+0x2e1/0x410 fs/namei.c:1993
 lookup_last fs/namei.c:2450 [inline]
 path_lookupat+0x17d/0x450 fs/namei.c:2474
 filename_lookup+0x285/0x660 fs/namei.c:2503
 vfs_statx+0x121/0x4e0 fs/stat.c:229
 do_statx fs/stat.c:643 [inline]
 __do_sys_statx fs/stat.c:670 [inline]
 __se_sys_statx fs/stat.c:661 [inline]
 __x64_sys_statx+0x1a1/0x230 fs/stat.c:661
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88801da23980
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 61 bytes inside of
 64-byte region [ffff88801da23980, ffff88801da239c0)

The buggy address belongs to the physical page:
page:ffffea00007688c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1da23
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00005f4180 dead000000000005 ffff888012041640
raw: 0000000000000000 0000000080200020 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 2958, tgid 2958 (rcS), ts 17935241643, free_ts 17125089933
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4288
 __alloc_pages+0x259/0x560 mm/page_alloc.c:5555
 alloc_slab_page+0x70/0xf0 mm/slub.c:1794
 allocate_slab+0x5e/0x4b0 mm/slub.c:1939
 new_slab mm/slub.c:1992 [inline]
 ___slab_alloc+0x7f4/0xeb0 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x252/0x310 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc+0x9e/0x1a0 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 tomoyo_commit_ok+0x24/0x1c0 security/tomoyo/memory.c:76
 tomoyo_update_domain+0x525/0x840 security/tomoyo/domain.c:139
 tomoyo_write_env security/tomoyo/environ.c:105 [inline]
 tomoyo_write_misc+0x1a5/0x220 security/tomoyo/environ.c:121
 tomoyo_write_domain2+0x1d7/0x240 security/tomoyo/common.c:1143
 tomoyo_add_entry security/tomoyo/common.c:2033 [inline]
 tomoyo_supervisor+0xdfd/0x1290 security/tomoyo/common.c:2094
 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline]
 tomoyo_env_perm+0x17b/0x210 security/tomoyo/environ.c:63
 tomoyo_environ security/tomoyo/domain.c:672 [inline]
 tomoyo_find_next_domain+0x16c6/0x1d80 security/tomoyo/domain.c:879
 tomoyo_bprm_check_security+0xe3/0x130 security/tomoyo/tomoyo.c:101
 security_bprm_check+0x50/0xb0 security/security.c:869
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare+0x80c/0x8f0 mm/page_alloc.c:1509
 free_unref_page_prepare mm/page_alloc.c:3387 [inline]
 free_unref_page+0x7d/0x630 mm/page_alloc.c:3483
 kasan_depopulate_vmalloc_pte+0x66/0x80 mm/kasan/shadow.c:372
 apply_to_pte_range mm/memory.c:2640 [inline]
 apply_to_pmd_range mm/memory.c:2684 [inline]
 apply_to_pud_range mm/memory.c:2720 [inline]
 apply_to_p4d_range mm/memory.c:2756 [inline]
 __apply_to_page_range+0x964/0xc70 mm/memory.c:2790
 kasan_release_vmalloc+0x96/0xb0 mm/kasan/shadow.c:486
 __purge_vmap_area_lazy+0xcfa/0x18a0 mm/vmalloc.c:1770
 _vm_unmap_aliases+0x487/0x4f0 mm/vmalloc.c:2173
 change_page_attr_set_clr+0x2e8/0x6f0 arch/x86/mm/pat/set_memory.c:1781
 change_page_attr_set arch/x86/mm/pat/set_memory.c:1831 [inline]
 set_memory_nx+0xee/0x130 arch/x86/mm/pat/set_memory.c:2024
 free_init_pages arch/x86/mm/init.c:908 [inline]
 free_kernel_image_pages arch/x86/mm/init.c:927 [inline]
 free_initmem+0x71/0xc0 arch/x86/mm/init.c:954
 kernel_init+0x2d/0x2b0 init/main.c:1528
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Memory state around the buggy address:
 ffff88801da23880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff88801da23900: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff88801da23980: 00 00 00 00 00 00 00 04 fc fc fc fc fc fc fc fc
                                        ^
 ffff88801da23a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88801da23a80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
==================================================================

Crashes (9):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2022/11/13 12:44 upstream fef7fd48922d 3ead01ad .config log report syz C KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-upstream-linux-next-kasan-gce-root 2022/09/03 18:22 linux-next e47eb90a0a9a 28811d0a .config log report syz C KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-upstream-kasan-gce-selinux-root 2022/09/03 19:56 upstream d895ec7938c4 28811d0a .config log report info KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-upstream-kasan-gce-selinux-root 2022/09/03 19:53 upstream d895ec7938c4 28811d0a .config log report info KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-qemu-upstream-386 2022/09/03 18:35 upstream d895ec7938c4 28811d0a .config log report info KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-qemu-upstream-386 2022/09/03 18:20 upstream d895ec7938c4 28811d0a .config log report info KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-upstream-linux-next-kasan-gce-root 2022/09/15 20:45 linux-next e47eb90a0a9a dd9a85ff .config log report info KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-upstream-linux-next-kasan-gce-root 2022/09/10 17:38 linux-next e47eb90a0a9a 356d8217 .config log report info KASAN: slab-out-of-bounds Read in ntfs_get_ea
ci-upstream-linux-next-kasan-gce-root 2022/09/03 17:36 linux-next e47eb90a0a9a 28811d0a .config log report info KASAN: slab-out-of-bounds Read in ntfs_get_ea
* Struck through repros no longer work on HEAD.