syzbot


KASAN: use-after-free Read in ntfs_lookup_inode_by_name

Status: upstream: reported C repro on 2023/05/14 03:12
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+fa205ddb906e0eef949c@syzkaller.appspotmail.com
First crash: 340d, last: 12d
Bug presence (2)
Date Name Commit Repro Result
2023/09/27 upstream (ToT) 633b47cb009d C [report] KASAN: use-after-free Read in ntfs_lookup_inode_by_name
2024/04/09 upstream (ToT) 20cb38a7af88 C Failed due to an error; will retry later
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in ntfs_lookup_inode_by_name origin:upstream missing-backport C error 8 16d 372d 0/3 upstream: reported C repro on 2023/04/12 03:50
upstream KASAN: use-after-free Read in ntfs_lookup_inode_by_name ntfs3 C error done 17 40d 475d 26/26 fixed on 2024/03/20 11:33
linux-4.19 KASAN: use-after-free Read in ntfs_lookup_inode_by_name ntfs C error 1 467d 467d 0/1 upstream: reported C repro on 2023/01/07 03:24
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2024/04/06 02:00 5h06m bisect fix linux-6.1.y job log (0) log
2024/02/01 20:53 1h03m bisect fix linux-6.1.y job log (0) log
2023/12/30 01:49 1h33m bisect fix linux-6.1.y job log (0) log
2023/11/29 23:39 1h07m bisect fix linux-6.1.y job log (0) log
2023/10/29 23:01 1h36m bisect fix linux-6.1.y job log (0) log
2023/09/27 15:56 1h06m bisect fix linux-6.1.y job log (0) log
2023/07/25 05:37 3h20m bisect fix linux-6.1.y job log (0) log

Sample crash report:
netdevsim netdevsim0 netdevsim3: set [1, 0] type 2 family 0 port 6081 - 0
loop0: detected capacity change from 0 to 4096
ntfs: volume version 3.1.
==================================================================
BUG: KASAN: use-after-free in sle64_to_cpup fs/ntfs/endian.h:46 [inline]
BUG: KASAN: use-after-free in ntfs_lookup_inode_by_name+0xe82/0x2ca0 fs/ntfs/dir.c:292
Read of size 8 at addr ffff8880bff1c55a by task syz-executor268/3542

CPU: 0 PID: 3542 Comm: syz-executor268 Not tainted 6.1.33-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
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
 sle64_to_cpup fs/ntfs/endian.h:46 [inline]
 ntfs_lookup_inode_by_name+0xe82/0x2ca0 fs/ntfs/dir.c:292
 check_windows_hibernation_status+0xec/0x4c0 fs/ntfs/super.c:1274
 load_system_files+0x35d7/0x4830 fs/ntfs/super.c:1989
 ntfs_fill_super+0x19b0/0x2bd0 fs/ntfs/super.c:2892
 mount_bdev+0x2c9/0x3f0 fs/super.c:1423
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1553
 do_new_mount+0x28b/0xae0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5b0cd85faa
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 f8 03 00 00 0f 1f 84 00 00 00 00 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:00007ffc14cded58 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f5b0cd85faa
RDX: 000000002001ec80 RSI: 000000002001ecc0 RDI: 00007ffc14cded70
RBP: 00007ffc14cded70 R08: 00007ffc14cdedb0 R09: 000000000001ec63
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000000004
R13: 000055555741d3b8 R14: 0000000000000000 R15: 00007ffc14cdedb0
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0002ffc700 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0xbff1c
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001c34848 ffffea0001225848 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 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 3535, tgid 3535 (sshd), ts 47612014875, free_ts 48149742640
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 __folio_alloc+0xf/0x30 mm/page_alloc.c:5591
 vma_alloc_folio+0x486/0x990 mm/mempolicy.c:2241
 alloc_page_vma include/linux/gfp.h:284 [inline]
 do_cow_fault mm/memory.c:4582 [inline]
 do_fault mm/memory.c:4694 [inline]
 handle_pte_fault mm/memory.c:4964 [inline]
 __handle_mm_fault mm/memory.c:5106 [inline]
 handle_mm_fault+0x2109/0x5330 mm/memory.c:5227
 do_user_addr_fault arch/x86/mm/fault.c:1428 [inline]
 handle_page_fault arch/x86/mm/fault.c:1519 [inline]
 exc_page_fault+0x58d/0x790 arch/x86/mm/fault.c:1575
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1460 [inline]
 free_pcp_prepare mm/page_alloc.c:1510 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
 free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530
 release_pages+0x2836/0x2b40 mm/swap.c:1055
 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
 tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
 tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
 exit_mmap+0x3c3/0x9f0 mm/mmap.c:3139
 __mmput+0x115/0x3c0 kernel/fork.c:1191
 exit_mm+0x226/0x300 kernel/exit.c:563
 do_exit+0x67e/0x2300 kernel/exit.c:856
 do_group_exit+0x202/0x2b0 kernel/exit.c:1019
 __do_sys_exit_group kernel/exit.c:1030 [inline]
 __se_sys_exit_group kernel/exit.c:1028 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1028
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff8880bff1c400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880bff1c480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880bff1c500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                    ^
 ffff8880bff1c580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880bff1c600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/12 10:40 linux-6.1.y 2f3918bc53fb 49519f06 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: use-after-free Read in ntfs_lookup_inode_by_name
2024/03/06 12:45 linux-6.1.y a3eb3a74aa8c f39a7eed .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_lookup_inode_by_name
2023/05/14 03:12 linux-6.1.y bf4ad6fa4e53 2b9ba477 .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_lookup_inode_by_name
2024/03/06 12:32 linux-6.1.y a3eb3a74aa8c f39a7eed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ntfs_lookup_inode_by_name
* Struck through repros no longer work on HEAD.