syzbot


KASAN: use-after-free Read in f2fs_release_page

Status: auto-obsoleted due to no activity on 2023/08/01 23:35
Subsystems: f2fs
[Documentation on labels]
Reported-by: syzbot+22816d25c2e79b0ce574@syzkaller.appspotmail.com
First crash: 697d, last: 597d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 general protection fault in f2fs_release_page f2fs 3 666d 707d 0/2 auto-obsoleted due to no activity on 2023/04/25 16:26
android-5-15 KASAN: use-after-free Read in f2fs_release_page f2fs 5 536d 685d 0/2 auto-obsoleted due to no activity on 2023/09/01 18:51
android-5-15 KASAN: use-after-free Read in f2fs_release_page (2) 1 326d 326d 0/2 auto-obsoleted due to no activity on 2024/03/30 07:06
android-5-10 KASAN: global-out-of-bounds Read in f2fs_release_page 2 536d 568d 0/2 auto-obsoleted due to no activity on 2023/09/02 15:33

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in F2FS_SB fs/f2fs/f2fs.h:1888 [inline]
BUG: KASAN: use-after-free in F2FS_I_SB fs/f2fs/f2fs.h:1893 [inline]
BUG: KASAN: use-after-free in F2FS_M_SB fs/f2fs/f2fs.h:1898 [inline]
BUG: KASAN: use-after-free in F2FS_P_SB fs/f2fs/f2fs.h:1903 [inline]
BUG: KASAN: use-after-free in f2fs_release_page+0x2a3/0xa40 fs/f2fs/data.c:3800
Read of size 8 at addr ffff8881e87a03f0 by task syz-executor.5/4614

CPU: 1 PID: 4614 Comm: syz-executor.5 Not tainted 5.4.233-syzkaller-00030-ga6b5274af71b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x241 lib/dump_stack.c:118
 print_address_description+0x8c/0x600 mm/kasan/report.c:384
 __kasan_report+0xf3/0x120 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 F2FS_SB fs/f2fs/f2fs.h:1888 [inline]
 F2FS_I_SB fs/f2fs/f2fs.h:1893 [inline]
 F2FS_M_SB fs/f2fs/f2fs.h:1898 [inline]
 F2FS_P_SB fs/f2fs/f2fs.h:1903 [inline]
 f2fs_release_page+0x2a3/0xa40 fs/f2fs/data.c:3800
 shrink_page_list+0x1444/0x3e70 mm/vmscan.c:1451
 shrink_inactive_list+0x4f6/0xfd0 mm/vmscan.c:2001
 shrink_list mm/vmscan.c:2293 [inline]
 shrink_node_memcg+0xc42/0x2430 mm/vmscan.c:2623
 shrink_node+0x396/0x12b0 mm/vmscan.c:2836
 shrink_zones mm/vmscan.c:3053 [inline]
 do_try_to_free_pages+0x625/0x1280 mm/vmscan.c:3111
 try_to_free_mem_cgroup_pages+0x3f6/0x9b0 mm/vmscan.c:3412
 memory_max_write+0x235/0x3c0 mm/memcontrol.c:6220
 cgroup_file_write+0x275/0x5c0 kernel/cgroup/cgroup.c:3898
 kernfs_fop_write+0x2e2/0x3e0 fs/kernfs/file.c:315
 __vfs_write+0x103/0x750 fs/read_write.c:494
 vfs_write+0x206/0x4e0 fs/read_write.c:558
 ksys_write+0x199/0x2c0 fs/read_write.c:611
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Allocated by task 4395:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x130/0x1d0 mm/kasan/common.c:529
 kmalloc include/linux/slab.h:561 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 __register_sysctl_table+0xdb/0x11d0 fs/proc/proc_sysctl.c:1332
 __addrconf_sysctl_register+0x28f/0x3e0 net/ipv6/addrconf.c:6945
 addrconf_sysctl_register+0x128/0x180 net/ipv6/addrconf.c:6992
 ipv6_add_dev+0xc12/0x1070 net/ipv6/addrconf.c:445
 addrconf_notify+0x59b/0xe50 net/ipv6/addrconf.c:3534
 notifier_call_chain kernel/notifier.c:98 [inline]
 __raw_notifier_call_chain kernel/notifier.c:399 [inline]
 raw_notifier_call_chain+0x95/0x110 kernel/notifier.c:406
 call_netdevice_notifiers_info net/core/dev.c:1670 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:1682 [inline]
 call_netdevice_notifiers net/core/dev.c:1696 [inline]
 register_netdevice+0xeef/0x12a0 net/core/dev.c:9207
 register_netdev+0x37/0x50 net/core/dev.c:9305
 loopback_net_init+0x6f/0x140 drivers/net/loopback.c:214
 ops_init+0x1d4/0x4a0 net/core/net_namespace.c:138
 setup_net+0x214/0x990 net/core/net_namespace.c:345
 copy_net_ns+0x30f/0x510 net/core/net_namespace.c:486
 create_new_namespaces+0x47a/0x570 kernel/nsproxy.c:103
 unshare_nsproxy_namespaces+0x119/0x170 kernel/nsproxy.c:202
 ksys_unshare+0x544/0x990 kernel/fork.c:2896
 __do_sys_unshare kernel/fork.c:2964 [inline]
 __se_sys_unshare kernel/fork.c:2962 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:2962
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Freed by task 9:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 kasan_set_free_info mm/kasan/common.c:345 [inline]
 __kasan_slab_free+0x178/0x230 mm/kasan/common.c:487
 slab_free_hook mm/slub.c:1455 [inline]
 slab_free_freelist_hook mm/slub.c:1494 [inline]
 slab_free mm/slub.c:3080 [inline]
 kfree+0xeb/0x320 mm/slub.c:4071
 __rcu_reclaim kernel/rcu/rcu.h:215 [inline]
 rcu_do_batch+0x451/0xa00 kernel/rcu/tree.c:2167
 rcu_core+0x4c8/0xcb0 kernel/rcu/tree.c:2387
 __do_softirq+0x22e/0x630 kernel/softirq.c:292

The buggy address belongs to the object at ffff8881e87a0000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1008 bytes inside of
 2048-byte region [ffff8881e87a0000, ffff8881e87a0800)
The buggy address belongs to the page:
page:ffffea0007a1e800 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c000
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
 get_page_from_freelist+0x2ce8/0x2d70 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891
 alloc_slab_page+0x39/0x3c0 mm/slub.c:343
 allocate_slab mm/slub.c:1683 [inline]
 new_slab+0x97/0x440 mm/slub.c:1749
 new_slab_objects mm/slub.c:2505 [inline]
 ___slab_alloc+0x2fe/0x490 mm/slub.c:2667
 __slab_alloc+0x5a/0x90 mm/slub.c:2707
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 __kmalloc+0x196/0x2b0 mm/slub.c:3909
 __kmalloc_node include/linux/slab.h:422 [inline]
 kmalloc_node include/linux/slab.h:599 [inline]
 kvmalloc_node+0x7e/0xf0 mm/util.c:596
 kvmalloc include/linux/mm.h:759 [inline]
 kvmalloc_array include/linux/mm.h:777 [inline]
 alloc_fdtable+0xcb/0x240 fs/file.c:115
 dup_fd+0x718/0xaa0 fs/file.c:310
 copy_files+0xe1/0x1f0 kernel/fork.c:1474
 copy_process+0x11e3/0x3230 kernel/fork.c:2029
 _do_fork+0x197/0x900 kernel/fork.c:2391
 __do_sys_clone kernel/fork.c:2549 [inline]
 __se_sys_clone kernel/fork.c:2530 [inline]
 __x64_sys_clone+0x26b/0x2c0 kernel/fork.c:2530
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1176 [inline]
 __free_pages_ok+0x83d/0x940 mm/page_alloc.c:1438
 free_the_page mm/page_alloc.c:4953 [inline]
 __free_pages+0x91/0x140 mm/page_alloc.c:4959
 __free_slab+0x221/0x2e0 mm/slub.c:1774
 free_slab mm/slub.c:1789 [inline]
 discard_slab mm/slub.c:1795 [inline]
 unfreeze_partials+0x14e/0x180 mm/slub.c:2288
 put_cpu_partial+0xb4/0x150 mm/slub.c:2324
 __slab_free+0x288/0x350 mm/slub.c:2971
 qlist_free_all+0x43/0xb0 mm/kasan/quarantine.c:167
 quarantine_reduce+0x174/0x190 mm/kasan/quarantine.c:260
 __kasan_kmalloc+0x43/0x1d0 mm/kasan/common.c:507
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc_node mm/slub.c:2829 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 kmem_cache_alloc+0xd0/0x220 mm/slub.c:2842
 getname_flags+0xb8/0x4e0 fs/namei.c:141
 getname fs/namei.c:212 [inline]
 __do_sys_unlink fs/namei.c:4191 [inline]
 __se_sys_unlink fs/namei.c:4189 [inline]
 __x64_sys_unlink+0x38/0x50 fs/namei.c:4189
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Memory state around the buggy address:
 ffff8881e87a0280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881e87a0300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881e87a0380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff8881e87a0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881e87a0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
syz-executor.5 invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=1000
CPU: 1 PID: 4614 Comm: syz-executor.5 Tainted: G    B             5.4.233-syzkaller-00030-ga6b5274af71b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x241 lib/dump_stack.c:118
 dump_header+0xd5/0x670 mm/oom_kill.c:460
 oom_kill_process+0xeb/0x2c0 mm/oom_kill.c:974
 out_of_memory+0x5e1/0x890 mm/oom_kill.c:1111
 mem_cgroup_out_of_memory+0x211/0x270 mm/memcontrol.c:1611
 memory_max_write+0x331/0x3c0 mm/memcontrol.c:6227
 cgroup_file_write+0x275/0x5c0 kernel/cgroup/cgroup.c:3898
 kernfs_fop_write+0x2e2/0x3e0 fs/kernfs/file.c:315
 __vfs_write+0x103/0x750 fs/read_write.c:494
 vfs_write+0x206/0x4e0 fs/read_write.c:558
 ksys_write+0x199/0x2c0 fs/read_write.c:611
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1
memory: usage 288kB, limit 0kB, failcnt 0
swap: usage 0kB, limit 9007199254740988kB, failcnt 0
Memory cgroup stats for /syz1:
anon 155648
file 143360
kernel_stack 0
slab 0
sock 4096
shmem 118784
file_mapped 135168
file_dirty 135168
file_writeback 0
anon_thp 0
inactive_anon 135168
active_anon 135168
inactive_file 0
active_file 81920
unevictable 0
slab_reclaimable 0
slab_unreclaimable 0
pgfault 221760
pgmajfault 0
workingset_refault 0
workingset_activate 0
workingset_nodereclaim 0
pgrefill 110
pgscan 687
pgsteal 603
pgactivate 2244
oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=syz5,mems_allowed=0,oom_memcg=/syz1,task_memcg=/syz1,task=syz-executor.1,pid=3327,uid=0
Memory cgroup out of memory: Killed process 3327 (syz-executor.1) total-vm:48508kB, anon-rss:476kB, file-rss:15192kB, shmem-rss:64kB, UID:0 pgtables:92kB oom_score_adj:0
syz-executor.5 invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=1000
CPU: 1 PID: 4614 Comm: syz-executor.5 Tainted: G    B             5.4.233-syzkaller-00030-ga6b5274af71b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x241 lib/dump_stack.c:118
 dump_header+0xd5/0x670 mm/oom_kill.c:460
 out_of_memory+0x642/0x890 mm/oom_kill.c:1100
 mem_cgroup_out_of_memory+0x211/0x270 mm/memcontrol.c:1611
 memory_max_write+0x331/0x3c0 mm/memcontrol.c:6227
 cgroup_file_write+0x275/0x5c0 kernel/cgroup/cgroup.c:3898
 kernfs_fop_write+0x2e2/0x3e0 fs/kernfs/file.c:315
 __vfs_write+0x103/0x750 fs/read_write.c:494
 vfs_write+0x206/0x4e0 fs/read_write.c:558
 ksys_write+0x199/0x2c0 fs/read_write.c:611
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1
memory: usage 132kB, limit 0kB, failcnt 0
swap: usage 0kB, limit 9007199254740988kB, failcnt 0
Memory cgroup stats for /syz1:
anon 16384
file 143360
kernel_stack 0
slab 0
sock 4096
shmem 118784
file_mapped 135168
file_dirty 135168
file_writeback 0
anon_thp 0
inactive_anon 135168
active_anon 0
inactive_file 0
active_file 81920
unevictable 0
slab_reclaimable 0
slab_unreclaimable 0
pgfault 221760
pgmajfault 0
workingset_refault 0
workingset_activate 0
workingset_nodereclaim 0
pgrefill 110
pgscan 687
pgsteal 603
pgactivate 2244
Out of memory and no killable processes...

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/04/03 23:34 android12-5.4 a6b5274af71b 41147e3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan KASAN: use-after-free Read in f2fs_release_page
2022/12/29 15:31 android12-5.4 a8aad8851131 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan KASAN: use-after-free Read in f2fs_release_page
2022/12/25 06:22 android12-5.4 a8aad8851131 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan KASAN: use-after-free Read in f2fs_release_page
2023/01/03 18:08 android12-5.4 a8aad8851131 f0036e18 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan general protection fault in f2fs_release_page
* Struck through repros no longer work on HEAD.