syzbot


KASAN: use-after-free Write in trylock_super

Status: auto-obsoleted due to no activity on 2023/09/19 19:51
Reported-by: syzbot+ca7ab3dc88cddf5fd925@syzkaller.appspotmail.com
First crash: 618d, last: 528d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Write in trylock_super vfs origin:lts syz error 32 93d 715d 0/2 premoderation: reported syz repro on 2022/12/07 03:02
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

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
BUG: KASAN: use-after-free in atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
BUG: KASAN: use-after-free in __down_read_trylock kernel/locking/rwsem.c:1408 [inline]
BUG: KASAN: use-after-free in down_read_trylock+0xba/0x1d0 kernel/locking/rwsem.c:1568
Write of size 8 at addr ffff8881a5f18070 by task kworker/u4:2/179

CPU: 1 PID: 179 Comm: kworker/u4:2 Not tainted 5.4.242-syzkaller-00065-g10e0626a3202 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Workqueue: writeback wb_workfn (flush-7:3)
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
 check_memory_region_inline mm/kasan/generic.c:141 [inline]
 check_memory_region+0x272/0x280 mm/kasan/generic.c:191
 atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
 atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
 __down_read_trylock kernel/locking/rwsem.c:1408 [inline]
 down_read_trylock+0xba/0x1d0 kernel/locking/rwsem.c:1568
 trylock_super+0x1b/0xf0 fs/super.c:418
 __writeback_inodes_wb fs/fs-writeback.c:1792 [inline]
 wb_writeback+0x499/0xd70 fs/fs-writeback.c:1907
 wb_check_background_flush fs/fs-writeback.c:1975 [inline]
 wb_do_writeback fs/fs-writeback.c:2063 [inline]
 wb_workfn+0xce8/0x1230 fs/fs-writeback.c:2091
 process_one_work+0x765/0xd20 kernel/workqueue.c:2287
 worker_thread+0xaef/0x1470 kernel/workqueue.c:2433
 kthread+0x2da/0x360 kernel/kthread.c:288
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354

Allocated by task 4936:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x171/0x210 mm/kasan/common.c:529
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 alloc_super+0x56/0x760 fs/super.c:203
 sget+0x1f1/0x4d0 fs/super.c:613
 mount_bdev+0xe4/0x340 fs/super.c:1390
 legacy_get_tree+0xdf/0x170 fs/fs_context.c:647
 vfs_get_tree+0x85/0x260 fs/super.c:1547
 do_new_mount+0x292/0x570 fs/namespace.c:2843
 do_mount+0x688/0xe10 fs/namespace.c:3163
 ksys_mount+0xc2/0xf0 fs/namespace.c:3372
 __do_sys_mount fs/namespace.c:3386 [inline]
 __se_sys_mount fs/namespace.c:3383 [inline]
 __x64_sys_mount+0xb1/0xc0 fs/namespace.c:3383
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Freed by task 8924:
 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+0x1b5/0x270 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+0x123/0x370 mm/slub.c:4071
 process_one_work+0x765/0xd20 kernel/workqueue.c:2287
 worker_thread+0xaef/0x1470 kernel/workqueue.c:2433
 kthread+0x2da/0x360 kernel/kthread.c:288
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354

The buggy address belongs to the object at ffff8881a5f18000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 112 bytes inside of
 2048-byte region [ffff8881a5f18000, ffff8881a5f18800)
The buggy address belongs to the page:
page:ffffea000697c600 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0xffff8881a5f1c000 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 ffffea0006883808 ffffea00068b0e08 ffff8881f5c0c000
raw: ffff8881a5f1c000 0000000000080001 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 0x1d2a20(GFP_ATOMIC|__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+0x2d13/0x2d90 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+0x62/0xa0 mm/slub.c:2707
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 __kmalloc_track_caller+0x16d/0x2b0 mm/slub.c:4449
 __kmalloc_reserve net/core/skbuff.c:142 [inline]
 pskb_expand_head+0x10c/0x10b0 net/core/skbuff.c:1647
 netlink_trim+0x198/0x230 net/netlink/af_netlink.c:1303
 netlink_broadcast_filtered+0x62/0x1280 net/netlink/af_netlink.c:1508
 netlink_broadcast net/netlink/af_netlink.c:1553 [inline]
 nlmsg_multicast include/net/netlink.h:968 [inline]
 nlmsg_notify+0xf7/0x1b0 net/netlink/af_netlink.c:2552
 __dev_notify_flags+0xe3/0x510 net/core/dev.c:7961
 rtnl_configure_link+0x21e/0x320 net/core/rtnetlink.c:2917
 veth_newlink+0x6f3/0xb70 drivers/net/veth.c:1311
 __rtnl_newlink net/core/rtnetlink.c:3232 [inline]
 rtnl_newlink+0x1511/0x2010 net/core/rtnetlink.c:3291
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+0x847/0x950 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+0x44/0x180 mm/slub.c:2324
 __slab_free+0x297/0x360 mm/slub.c:2971
 qlist_free_all+0x43/0xb0 mm/kasan/quarantine.c:167
 quarantine_reduce+0x1d9/0x210 mm/kasan/quarantine.c:260
 __kasan_kmalloc+0x41/0x210 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_trace+0xdc/0x260 mm/slub.c:2854
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 inetdev_init+0x7e/0x450 net/ipv4/devinet.c:259
 inetdev_event+0x205/0x1040 net/ipv4/devinet.c:1531
 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:9209
 veth_newlink+0x833/0xb70 drivers/net/veth.c:1330
 __rtnl_newlink net/core/rtnetlink.c:3232 [inline]
 rtnl_newlink+0x1511/0x2010 net/core/rtnetlink.c:3291

Memory state around the buggy address:
 ffff8881a5f17f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881a5f17f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881a5f18000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff8881a5f18080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881a5f18100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/11 19:50 android12-5.4 10e0626a3202 49519f06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan KASAN: use-after-free Write in trylock_super
2023/05/08 06:40 android12-5.4 0fcb7cff9462 90c93c40 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan KASAN: use-after-free Write in trylock_super
2023/05/04 11:30 android12-5.4 cf4e000017b8 3a560463 .config console log report info ci2-android-5-4-kasan KASAN: use-after-free Write in trylock_super
2023/03/14 12:05 android12-5.4 250ac66f1853 0d5c4377 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan KASAN: use-after-free Write in trylock_super
* Struck through repros no longer work on HEAD.