syzbot


KASAN: use-after-free Read in udf_sync_fs

Status: upstream: reported C repro on 2023/06/18 11:33
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+97957ab65c3db5758ee8@syzkaller.appspotmail.com
First crash: 320d, last: 12d
Bug presence (1)
Date Name Commit Repro Result
2023/06/18 upstream (ToT) 1b29d271614a 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-5.15 KASAN: use-after-free Read in udf_sync_fs origin:upstream C 11 7d22h 321d 0/3 upstream: reported C repro on 2023/06/16 18:53
upstream KASAN: use-after-free Read in udf_sync_fs udf C done done 37 126d 265d 26/26 fixed on 2024/02/03 12:44
Fix bisection attempts (6)
Created Duration User Patch Repo Result
2024/03/23 23:21 1h20m bisect fix linux-6.1.y job log (0) log
2024/02/22 16:44 2h16m bisect fix linux-6.1.y job log (0) log
2023/12/26 08:01 1h11m bisect fix linux-6.1.y job log (0) log
2023/11/25 09:21 1h14m bisect fix linux-6.1.y job log (0) log
2023/10/22 05:47 1h29m bisect fix linux-6.1.y job log (0) log
2023/09/17 01:49 1h47m bisect fix linux-6.1.y job log (0) log

Sample crash report:
loop0: detected capacity change from 0 to 2048
UDF-fs: INFO Mounting volume 'LiuxUDF', 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 ffff8880735a4000 by task syz-executor224/3542

CPU: 0 PID: 3542 Comm: syz-executor224 Not tainted 6.1.87-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/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
 crc_itu_t+0x218/0x2a0 lib/crc-itu-t.c:60
 udf_finalize_lvid fs/udf/super.c:2022 [inline]
 udf_sync_fs+0x1ce/0x380 fs/udf/super.c:2378
 sync_filesystem+0xe8/0x220 fs/sync.c:56
 generic_shutdown_super+0x6b/0x340 fs/super.c:474
 kill_block_super+0x7a/0xe0 fs/super.c:1459
 deactivate_locked_super+0xa0/0x110 fs/super.c:332
 cleanup_mnt+0x490/0x520 fs/namespace.c:1186
 task_work_run+0x246/0x300 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xa73/0x26a0 kernel/exit.c:869
 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:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fe58ce02e09
Code: Unable to access opcode bytes at 0x7fe58ce02ddf.
RSP: 002b:00007ffdeca67828 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fe58ce02e09
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001
RBP: 00007fe58ce85390 R08: ffffffffffffffb8 R09: 0000000000000003
R10: 0000000000007a00 R11: 0000000000000246 R12: 00007fe58ce85390
R13: 0000000000000000 R14: 00007fe58ce86100 R15: 00007fe58cdd10e0
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001cd6900 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x735a4
flags: 0xfff80000000000(node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000000000 ffffea0001318048 ffffea0001cd4a08 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 3542, tgid 3542 (syz-executor224), ts 50830331692, free_ts 50904555895
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
 prep_new_page mm/page_alloc.c:2520 [inline]
 get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
 __folio_alloc+0xf/0x30 mm/page_alloc.c:5579
 vma_alloc_folio+0x486/0x990 mm/mempolicy.c:2243
 shmem_alloc_folio mm/shmem.c:1589 [inline]
 shmem_alloc_and_acct_folio+0x5a8/0xd50 mm/shmem.c:1613
 shmem_get_folio_gfp+0x13f0/0x3470 mm/shmem.c:1941
 shmem_get_folio mm/shmem.c:2072 [inline]
 shmem_write_begin+0x16e/0x4e0 mm/shmem.c:2559
 generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3817
 __generic_file_write_iter+0x176/0x400 mm/filemap.c:3945
 generic_file_write_iter+0xab/0x310 mm/filemap.c:3977
 call_write_iter include/linux/fs.h:2265 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x7ae/0xba0 fs/read_write.c:584
 ksys_write+0x19c/0x2c0 fs/read_write.c:637
 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
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1440 [inline]
 free_pcp_prepare mm/page_alloc.c:1490 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3499
 release_pages+0x2836/0x2b40 mm/swap.c:1055
 __pagevec_release+0x80/0xf0 mm/swap.c:1075
 pagevec_release include/linux/pagevec.h:71 [inline]
 folio_batch_release include/linux/pagevec.h:135 [inline]
 shmem_undo_range+0x865/0x2390 mm/shmem.c:946
 shmem_truncate_range mm/shmem.c:1062 [inline]
 shmem_evict_inode+0x265/0xa60 mm/shmem.c:1171
 evict+0x2a4/0x620 fs/inode.c:666
 __dentry_kill+0x436/0x650 fs/dcache.c:607
 dentry_kill+0xbb/0x290
 dput+0xfb/0x1d0 fs/dcache.c:914
 __fput+0x5e4/0x890 fs/file_table.c:328
 task_work_run+0x246/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87

Memory state around the buggy address:
 ffff8880735a3f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880735a3f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880735a4000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff8880735a4080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880735a4100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/21 13:55 linux-6.1.y 6741e066ec76 af24b050 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan KASAN: use-after-free Read in udf_sync_fs
2023/06/18 11:33 linux-6.1.y ca87e77a2ef8 f3921d4d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan KASAN: use-after-free Read in udf_sync_fs
2023/07/03 05:41 linux-6.1.y 0f4ac6b4c5f0 bfc47836 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan KASAN: use-after-free Read in udf_sync_fs
2023/06/18 21:57 linux-6.1.y ca87e77a2ef8 f3921d4d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan KASAN: use-after-free Read in udf_sync_fs
2024/01/12 20:22 linux-6.1.y 7c58bfa711cb 551587c1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in udf_sync_fs
* Struck through repros no longer work on HEAD.