syzbot


KASAN: use-after-free Write in trylock_super

Status: premoderation: reported syz repro on 2022/12/07 03:02
Bug presence: origin:lts
Subsystems: vfs
[Documentation on labels]
Reported-by: syzbot+3d75f4b11f4c378ec606@syzkaller.appspotmail.com
First crash: 715d, last: 93d
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2023/11/26 lts (merge base) 12952a23a5da C [report] KASAN: use-after-free Read in trylock_super
2023/11/26 upstream (ToT) d2da77f431ac C Didn't crash
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Write in trylock_super 4 528d 618d 0/2 auto-obsoleted due to no activity on 2023/09/19 19:51
android-5-10 KASAN: use-after-free Write in trylock_super vfs syz inconclusive 74 53d 721d 0/2 premoderation: reported syz repro on 2022/11/30 20:27
upstream KASAN: slab-use-after-free Read in trylock_super fs 1 599d 595d 0/28 auto-obsoleted due to no activity on 2023/07/01 04:40
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/08/13 14:47 15m retest repro android13-5.15-lts report log
2024/03/01 15:54 10m retest repro android13-5.15-lts report log
2023/12/10 19:54 12m retest repro android13-5.15-lts report log
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2024/10/15 02:33 0m bisect fix android13-5.15-lts error job log
2024/06/04 13:04 1h33m bisect fix android13-5.15-lts OK (0) job log log
2024/03/31 20:57 1h48m bisect fix android13-5.15-lts OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/linux/atomic/atomic-instrumented.h:1183 [inline]
BUG: KASAN: use-after-free in __down_read_trylock kernel/locking/rwsem.c:1319 [inline]
BUG: KASAN: use-after-free in down_read_trylock+0x7c/0x300 kernel/locking/rwsem.c:1586
Read of size 8 at addr ffff8881146eb070 by task kworker/u4:1/10

CPU: 0 PID: 10 Comm: kworker/u4:1 Not tainted 5.15.137-syzkaller-01792-g61cfd264993d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
Workqueue: writeback wb_workfn (flush-7:1)
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
 __kasan_check_read+0x11/0x20 mm/kasan/shadow.c:31
 instrument_atomic_read include/linux/instrumented.h:71 [inline]
 atomic_long_read include/linux/atomic/atomic-instrumented.h:1183 [inline]
 __down_read_trylock kernel/locking/rwsem.c:1319 [inline]
 down_read_trylock+0x7c/0x300 kernel/locking/rwsem.c:1586
 trylock_super+0x1f/0xf0 fs/super.c:418
 __writeback_inodes_wb+0x101/0x3f0 fs/fs-writeback.c:1975
 wb_writeback+0x3cd/0x9e0 fs/fs-writeback.c:2089
 wb_check_old_data_flush fs/fs-writeback.c:2189 [inline]
 wb_do_writeback fs/fs-writeback.c:2242 [inline]
 wb_workfn+0xb3d/0x1110 fs/fs-writeback.c:2271
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2317
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2464
 kthread+0x421/0x510 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 9105:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 kmem_cache_alloc_trace+0x115/0x210 mm/slub.c:3267
 kmalloc include/linux/slab.h:603 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 alloc_super+0x5d/0x7d0 fs/super.c:203
 sget+0x1e5/0x4c0 fs/super.c:624
 mount_bdev+0xea/0x3b0 fs/super.c:1360
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:4551
 legacy_get_tree+0xf1/0x190 fs/fs_context.c:611
 vfs_get_tree+0x88/0x290 fs/super.c:1517
 do_new_mount+0x28b/0xad0 fs/namespace.c:2994
 path_mount+0x671/0x1070 fs/namespace.c:3324
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2c4/0x3b0 fs/namespace.c:3522
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3522
 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+0x61/0xcb

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 insert_work+0x56/0x320 kernel/workqueue.c:1373
 __queue_work+0x92a/0xcd0 kernel/workqueue.c:1539
 queue_work_on+0x105/0x170 kernel/workqueue.c:1566
 queue_work include/linux/workqueue.h:509 [inline]
 schedule_work include/linux/workqueue.h:570 [inline]
 destroy_super_rcu+0xd1/0xe0 fs/super.c:172
 rcu_do_batch+0x57a/0xc10 kernel/rcu/tree.c:2510
 rcu_core+0x517/0x1020 kernel/rcu/tree.c:2750
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2763
 __do_softirq+0x26d/0x5bf kernel/softirq.c:565

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x133/0x12a0 kernel/rcu/tree.c:3074
 __put_super+0x26d/0x2e0 fs/super.c:299
 put_super fs/super.c:313 [inline]
 deactivate_locked_super+0xe1/0x110 fs/super.c:346
 deactivate_super+0xbe/0xf0 fs/super.c:366
 cleanup_mnt+0x45c/0x510 fs/namespace.c:1143
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1150
 task_work_run+0x129/0x190 kernel/task_work.c:164
 ptrace_notify+0x29e/0x350 kernel/signal.c:2383
 ptrace_report_syscall include/linux/tracehook.h:66 [inline]
 tracehook_report_syscall_exit include/linux/tracehook.h:130 [inline]
 arch_syscall_exit_tracehook include/linux/entry-common.h:297 [inline]
 syscall_exit_work kernel/entry/common.c:256 [inline]
 syscall_exit_to_user_mode_prepare kernel/entry/common.c:283 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:288 [inline]
 syscall_exit_to_user_mode+0xac/0x160 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff8881146eb000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 112 bytes inside of
 2048-byte region [ffff8881146eb000, ffff8881146eb800)
The buggy address belongs to the page:
page:ffffea000451ba00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8881146eb000 pfn:0x1146e8
head:ffffea000451ba00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea000480ba08 ffffea0004365608 ffff888100043200
raw: ffff8881146eb000 0000000000080004 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), pid 325, ts 25273862628, free_ts 25216980141
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2602
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2608
 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4482
 __alloc_pages+0x206/0x5e0 mm/page_alloc.c:5773
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0x9a/0x4e0 mm/slub.c:1995
 ___slab_alloc+0x39e/0x830 mm/slub.c:3028
 __slab_alloc+0x4a/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc_trace+0x142/0x210 mm/slub.c:3265
 kmem_cache_alloc_node_trace include/linux/slab.h:491 [inline]
 kmalloc_node include/linux/slab.h:621 [inline]
 kzalloc_node include/linux/slab.h:744 [inline]
 alloc_mem_cgroup_per_node_info mm/memcontrol.c:5176 [inline]
 mem_cgroup_alloc mm/memcontrol.c:5254 [inline]
 mem_cgroup_css_alloc+0x191/0x13a0 mm/memcontrol.c:5302
 css_create kernel/cgroup/cgroup.c:5383 [inline]
 cgroup_apply_control_enable+0x351/0xd30 kernel/cgroup/cgroup.c:3200
 cgroup_mkdir+0x11e6/0x1490 kernel/cgroup/cgroup.c:5601
 kernfs_iop_mkdir+0x1c4/0x2d0 fs/kernfs/dir.c:1163
 vfs_mkdir+0x3f6/0x610 fs/namei.c:3994
 do_mkdirat+0x1eb/0x450 fs/namei.c:4019
 __do_sys_mkdirat fs/namei.c:4034 [inline]
 __se_sys_mkdirat fs/namei.c:4032 [inline]
 __x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4032
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1469 [inline]
 free_pcp_prepare mm/page_alloc.c:1541 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3531
 free_unref_page+0xe6/0x730 mm/page_alloc.c:3613
 free_the_page mm/page_alloc.c:802 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5849
 __free_slab+0xec/0x1d0 mm/slub.c:2020
 free_slab mm/slub.c:2035 [inline]
 discard_slab mm/slub.c:2041 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2527
 put_cpu_partial+0xc4/0x120 mm/slub.c:2607
 __slab_free+0x1c8/0x290 mm/slub.c:3388
 do_slab_free mm/slub.c:3507 [inline]
 ___cache_free+0x109/0x120 mm/slub.c:3526
 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x44/0xb0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:443
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3240 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc+0xf5/0x200 mm/slub.c:3253
 kmem_cache_alloc_node include/linux/slab.h:474 [inline]
 __alloc_skb+0xbe/0x550 net/core/skbuff.c:416
 alloc_skb_fclone include/linux/skbuff.h:1233 [inline]
 sk_stream_alloc_skb+0x1f8/0xad0 net/ipv4/tcp.c:887

Memory state around the buggy address:
 ffff8881146eaf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881146eaf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881146eb000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff8881146eb080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881146eb100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (32):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/11/26 19:49 android13-5.15-lts 61cfd264993d 5b429f39 .config strace log report syz [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/04/04 02:03 android13-5.15-lts 7364b7abbafb 41147e3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in trylock_super
2023/03/18 15:57 android13-5.15-lts 5448b2fda85f 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in trylock_super
2023/03/10 17:25 android13-5.15-lts 5448b2fda85f 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in trylock_super
2023/01/18 20:41 android13-5.15-lts c73b4619ad86 4620c2d9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in trylock_super
2022/12/21 14:46 android13-5.15-lts c73b4619ad86 4067838e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in trylock_super
2022/12/09 03:31 android13-5.15-lts 7048384c9872 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in trylock_super
2022/12/07 03:01 android13-5.15-lts 92f701cae0bc d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in trylock_super
2024/08/19 22:23 android13-5.15-lts 29d153aabd54 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2024/06/26 01:35 android13-5.15-lts 9044d25b8ff5 dec8bc94 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2024/06/13 10:02 android13-5.15-lts 79bd336c7a94 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2024/02/16 15:47 android13-5.15-lts 993bed180178 578f7538 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2024/01/14 05:13 android13-5.15-lts ea2937bdd12f 551587c1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/12/31 18:54 android13-5.15-lts 28e3f5851a99 fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/12/15 14:15 android13-5.15-lts 05ef4ccb5774 3222d10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/11/23 10:13 android13-5.15-lts 61cfd264993d fc59b78e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/11/22 18:41 android13-5.15-lts 61cfd264993d 03e12510 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/11/10 17:56 android13-5.15-lts 61cfd264993d 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/10/19 21:23 android13-5.15-lts 754f8cc9b7de 42e1d524 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/10/17 13:29 android13-5.15-lts 754f8cc9b7de 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/10/12 23:57 android13-5.15-lts ea586874d2f9 6388bc36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/10/09 18:12 android13-5.15-lts ea586874d2f9 3c53c7d9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/08/13 00:46 android13-5.15-lts 1463976ddc64 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/07/23 18:48 android13-5.15-lts 879959450ec7 27cbe77f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/06/25 13:56 android13-5.15-lts 565c3abfa129 79782afc .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/06/20 19:54 android13-5.15-lts 36f4f6fb72d5 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/06/05 14:55 android13-5.15-lts 19c0ed55a470 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/06/02 21:03 android13-5.15-lts 19c0ed55a470 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/05/28 10:40 android13-5.15-lts 19c0ed55a470 cf184559 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/05/14 01:15 android13-5.15-lts 19c0ed55a470 2b9ba477 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/05/10 19:26 android13-5.15-lts 19c0ed55a470 14b12a99 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
2023/05/04 09:25 android13-5.15-lts 19c0ed55a470 5b7ff9dd .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in trylock_super
* Struck through repros no longer work on HEAD.