syzbot


KASAN: use-after-free Read in udf_sync_fs

Status: upstream: reported C repro on 2023/06/16 18:53
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+d8d08094ff268799bae7@syzkaller.appspotmail.com
First crash: 324d, last: 10d
Bug presence (1)
Date Name Commit Repro Result
2023/06/16 upstream (ToT) 4973ca295528 C [report] KASAN: use-after-free Read in udf_sync_fs
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in udf_sync_fs origin:upstream C 6 2d11h 322d 0/3 upstream: reported C repro on 2023/06/18 11:33
upstream KASAN: use-after-free Read in udf_sync_fs udf C done done 37 129d 268d 26/26 fixed on 2024/02/03 12:44
Fix bisection attempts (6)
Created Duration User Patch Repo Result
2024/03/31 22:48 1h24m bisect fix linux-5.15.y job log (0) log
2024/03/01 11:46 1h59m bisect fix linux-5.15.y job log (0) log
2024/01/21 12:34 1h50m bisect fix linux-5.15.y job log (0) log
2023/12/07 04:17 1h08m bisect fix linux-5.15.y job log (0) log
2023/10/21 19:29 1h00m bisect fix linux-5.15.y job log (0) log
2023/09/21 07:23 1h18m bisect fix linux-5.15.y job log (0) log

Sample crash report:
         option from the mount to silence this warning.
=======================================================
UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2022/11/22 14:59 (1000)
==================================================================
BUG: KASAN: use-after-free in crc_itu_t+0x218/0x2a0 lib/crc-itu-t.c:60
Read of size 1 at addr ffff88807333b000 by task syz-executor251/3500

CPU: 1 PID: 3500 Comm: syz-executor251 Not tainted 5.15.156-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 crc_itu_t+0x218/0x2a0 lib/crc-itu-t.c:60
 udf_finalize_lvid fs/udf/super.c:2025 [inline]
 udf_sync_fs+0x1ce/0x380 fs/udf/super.c:2381
 sync_filesystem+0xe8/0x220 fs/sync.c:56
 generic_shutdown_super+0x6e/0x2c0 fs/super.c:448
 kill_block_super+0x7a/0xe0 fs/super.c:1414
 deactivate_locked_super+0xa0/0x110 fs/super.c:335
 cleanup_mnt+0x44e/0x500 fs/namespace.c:1143
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 exit_task_work include/linux/task_work.h:32 [inline]
 do_exit+0x6a3/0x2480 kernel/exit.c:872
 do_group_exit+0x144/0x310 kernel/exit.c:994
 __do_sys_exit_group kernel/exit.c:1005 [inline]
 __se_sys_exit_group kernel/exit.c:1003 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1003
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7ffa6c5d7609
Code: Unable to access opcode bytes at RIP 0x7ffa6c5d75df.
RSP: 002b:00007fffb0288488 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007ffa6c5d7609
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001
RBP: 00007ffa6c6812d0 R08: ffffffffffffffb0 R09: 0000000000000004
R10: 0000000000001400 R11: 0000000000000246 R12: 00007ffa6c6812d0
R13: 0000000000000000 R14: 00007ffa6c682040 R15: 00007ffa6c5a25c0
 </TASK>

The buggy address belongs to the page:
page:ffffea0001cccec0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7333b
flags: 0xfff80000000000(node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000000000 ffffea0002d60508 ffffea0001c6b888 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 0x1100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), pid 3500, ts 49757444759, free_ts 49786088375
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 alloc_pages_vma+0x39a/0x800 mm/mempolicy.c:2146
 do_anonymous_page mm/memory.c:3808 [inline]
 handle_pte_fault mm/memory.c:4619 [inline]
 __handle_mm_fault mm/memory.c:4756 [inline]
 handle_mm_fault+0x2f49/0x5950 mm/memory.c:4854
 do_user_addr_fault arch/x86/mm/fault.c:1388 [inline]
 handle_page_fault arch/x86/mm/fault.c:1476 [inline]
 exc_page_fault+0x271/0x740 arch/x86/mm/fault.c:1532
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page_list+0x1f7/0x8e0 mm/page_alloc.c:3433
 release_pages+0x1bb9/0x1f40 mm/swap.c:963
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu mm/mmu_gather.c:247 [inline]
 tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338
 unmap_region+0x304/0x350 mm/mmap.c:2668
 __do_munmap+0x12db/0x1740 mm/mmap.c:2899
 __vm_munmap+0x134/0x230 mm/mmap.c:2922
 __do_sys_munmap mm/mmap.c:2948 [inline]
 __se_sys_munmap mm/mmap.c:2944 [inline]
 __x64_sys_munmap+0x67/0x70 mm/mmap.c:2944
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff88807333af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807333af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807333b000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88807333b080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807333b100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/25 16:45 linux-5.15.y c52b9710c83d 8bdc0f22 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2024/04/23 00:14 linux-5.15.y c52b9710c83d 36c961ad .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2023/06/16 18:52 linux-5.15.y 471e639e59d1 f3921d4d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2023/06/28 04:46 linux-5.15.y f67653019430 4cd5bb25 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2023/06/23 17:52 linux-5.15.y f67653019430 79782afc .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2023/06/20 20:35 linux-5.15.y 471e639e59d1 09ffe269 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2024/04/22 22:40 linux-5.15.y c52b9710c83d 36c961ad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2024/04/22 22:39 linux-5.15.y c52b9710c83d 36c961ad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2023/12/22 04:25 linux-5.15.y 1d146b1875fc 4f9530a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2023/11/06 20:44 linux-5.15.y 12952a23a5da 78fae24e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
2023/07/07 21:52 linux-5.15.y d54cfc420586 668cb1fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in udf_sync_fs
* Struck through repros no longer work on HEAD.