syzbot


KASAN: use-after-free Read in ntfs_attr_find (2)

Status: upstream: reported C repro on 2023/12/22 04:54
Bug presence: origin:lts-only
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+af4e5d45b6b48a6e89b6@syzkaller.appspotmail.com
First crash: 421d, last: 68d
Fix bisection: the issue occurs on the latest tested release (bisect log)
Crash: KASAN: use-after-free Read in ntfs_attr_find (log)
Repro: C syz .config
  
Bug presence (2)
Date Name Commit Repro Result
2024/12/09 linux-6.1.y (ToT) e4d90d63d385 C [report] KASAN: use-after-free Read in ntfs_attr_find
2024/12/09 upstream (ToT) fac04efc5c79 C Didn't crash
Similar bugs (9)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in ntfs_attr_find missing-backport origin:lts-only C done 5 56d 391d 0/3 upstream: reported C repro on 2024/01/20 12:39
upstream KASAN: use-after-free Read in ntfs_attr_find ntfs3 C done 74 738d 904d 22/28 fixed on 2023/02/24 13:50
linux-6.1 KASAN: use-after-free Read in ntfs_attr_find 3 664d 675d 0/3 auto-obsoleted due to no activity on 2023/08/21 05:46
linux-4.14 KASAN: slab-out-of-bounds Read in ntfs_attr_find (2) C 31 719d 904d 0/1 upstream: reported C repro on 2022/08/25 11:21
upstream KASAN: use-after-free Read in ntfs_attr_find (2) ntfs3 C error done 22 363d 716d 0/28 auto-obsoleted due to no activity on 2024/05/28 05:52
linux-4.19 KASAN: use-after-free Read in ntfs_attr_find (2) C 1 720d 720d 0/1 upstream: reported C repro on 2023/02/26 02:15
linux-4.14 KASAN: use-after-free Read in ntfs_attr_find C done 4 1586d 1605d 1/1 fixed on 2020/11/12 10:36
linux-4.19 KASAN: use-after-free Read in ntfs_attr_find C done 13 1571d 1602d 1/1 fixed on 2020/11/27 11:32
linux-5.15 KASAN: slab-out-of-bounds Read in ntfs_attr_find 1 663d 663d 0/3 auto-obsoleted due to no activity on 2023/08/22 04:27
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2024/04/01 10:58 2h22m fix candidate upstream OK (0) job log
2024/03/01 05:41 1h35m bisect fix linux-6.1.y OK (0) job log log
2024/01/21 16:21 1h52m bisect fix linux-6.1.y OK (0) job log log

Sample crash report:
loop0: detected capacity change from 0 to 4096
ntfs: (device loop0): is_boot_sector_ntfs(): Invalid end of sector marker.
==================================================================
BUG: KASAN: use-after-free in ntfs_attr_find+0x7d6/0xd50 fs/ntfs/attrib.c:609
Read of size 2 at addr ffff88806e10f042 by task syz-executor418/4246

CPU: 1 PID: 4246 Comm: syz-executor418 Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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_attr_find+0x7d6/0xd50 fs/ntfs/attrib.c:609
 ntfs_attr_lookup+0x4e0/0x2390
 ntfs_read_locked_inode+0xa34/0x49c0 fs/ntfs/inode.c:666
 ntfs_read_inode_mount+0xda2/0x2660 fs/ntfs/inode.c:2098
 ntfs_fill_super+0x1880/0x2bd0 fs/ntfs/super.c:2855
 mount_bdev+0x2c9/0x3f0 fs/super.c:1443
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:632
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3056
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3584
 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:0x7fe291e48dea
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc5a70cb08 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc5a70cb20 RCX: 00007fe291e48dea
RDX: 00000000200000c0 RSI: 00000000200001c0 RDI: 00007ffc5a70cb20
RBP: 0000000000000004 R08: 00007ffc5a70cb60 R09: 000000000001f63d
R10: 0000000000000004 R11: 0000000000000286 R12: 0000000000000004
R13: 00007ffc5a70cb60 R14: 0000000000000003 R15: 0000000000200000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001b843c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x6e10f
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001b84408 ffff8880b8f411e0 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x8(__GFP_MOVABLE), pid 1, tgid 1 (swapper/0), ts 17673896441, free_ts 19018173538
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
 split_map_pages+0x246/0x510 mm/compaction.c:97
 isolate_freepages_range+0x47c/0x4e0 mm/compaction.c:735
 alloc_contig_range+0x62a/0x990 mm/page_alloc.c:9425
 __alloc_contig_pages mm/page_alloc.c:9448 [inline]
 alloc_contig_pages+0x3f0/0x4e0 mm/page_alloc.c:9528
 debug_vm_pgtable_alloc_huge_page+0xb9/0x108 mm/debug_vm_pgtable.c:1098
 init_args+0xc92/0x1022 mm/debug_vm_pgtable.c:1221
 debug_vm_pgtable+0xaa/0x46b mm/debug_vm_pgtable.c:1259
 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
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
 free_contig_range+0x9a/0x150 mm/page_alloc.c:9550
 destroy_args+0xfe/0x997 mm/debug_vm_pgtable.c:1031
 debug_vm_pgtable+0x416/0x46b mm/debug_vm_pgtable.c:1354
 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

Memory state around the buggy address:
 ffff88806e10ef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88806e10ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88806e10f000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                           ^
 ffff88806e10f080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88806e10f100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/08 23:20 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: use-after-free Read in ntfs_attr_find
2024/05/16 08:27 linux-6.1.y 909ba1f1b414 ef5d53ed .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ntfs_attr_find
2023/12/22 04:53 linux-6.1.y 4aa6747d9352 4f9530a3 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ntfs_attr_find
* Struck through repros no longer work on HEAD.