syzbot


KASAN: use-after-free Read in nilfs_set_link

Status: auto-obsoleted due to no activity on 2024/10/26 08:47
Reported-by: syzbot+331072927e171e0e2d40@syzkaller.appspotmail.com
First crash: 137d, last: 137d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in nilfs_set_link nilfs C inconclusive done 3 330d 326d 0/28 auto-obsoleted due to no activity on 2024/04/16 20:38
linux-5.15 KASAN: use-after-free Read in nilfs_set_link C done 1 137d 137d 3/3 fixed on 2024/08/28 13:04

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in nilfs_set_link+0x231/0x2b0 fs/nilfs2/dir.c:426
Read of size 2 at addr ffff88806afd3008 by task syz.1.2814/13592

CPU: 1 PID: 13592 Comm: syz.1.2814 Not tainted 6.1.99-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/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
 nilfs_set_link+0x231/0x2b0 fs/nilfs2/dir.c:426
 nilfs_rename+0x68f/0x770 fs/nilfs2/namei.c:414
 vfs_rename+0xd32/0x10f0 fs/namei.c:4876
 do_renameat2+0xde0/0x1440 fs/namei.c:5029
 __do_sys_renameat2 fs/namei.c:5062 [inline]
 __se_sys_renameat2 fs/namei.c:5059 [inline]
 __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5059
 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:0x7fbfc1f75ad9
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbfc2cba048 EFLAGS: 00000246 ORIG_RAX: 000000000000013c
RAX: ffffffffffffffda RBX: 00007fbfc2103f60 RCX: 00007fbfc1f75ad9
RDX: 0000000000000005 RSI: 00000000200001c0 RDI: 0000000000000005
RBP: 00007fbfc1fe4e5d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020000200 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fbfc2103f60 R15: 00007ffd30514908
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001abf4c0 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x1 pfn:0x6afd3
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea000154ea08 ffffea0001580308 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffff7f 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 13499, tgid 13498 (syz.0.2799), ts 537566994581, free_ts 539908948115
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
 prep_new_page mm/page_alloc.c:2524 [inline]
 get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4283
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5551
 __folio_alloc+0xf/0x30 mm/page_alloc.c:5583
 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+0x857/0xbc0 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:1444 [inline]
 free_pcp_prepare mm/page_alloc.c:1494 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3362
 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3503
 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+0x62e/0x8d0 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:
 ffff88806afd2f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88806afd2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88806afd3000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                      ^
 ffff88806afd3080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88806afd3100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/18 08:46 linux-6.1.y cac15753b8ce 0f902625 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in nilfs_set_link
* Struck through repros no longer work on HEAD.