================================================================== BUG: KASAN: use-after-free in nilfs_segctor_confirm+0x175/0x190 fs/nilfs2/segment.c:837 Read of size 8 at addr ffff888025a5ec30 by task syz-executor.4/5123 CPU: 1 PID: 5123 Comm: syz-executor.4 Not tainted 6.0.0-syzkaller-09589-g55be6084c8e0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x6e9 mm/kasan/report.c:433 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495 nilfs_segctor_confirm+0x175/0x190 fs/nilfs2/segment.c:837 nilfs_segctor_destroy fs/nilfs2/segment.c:2729 [inline] nilfs_detach_log_writer+0x856/0x9f0 fs/nilfs2/segment.c:2810 nilfs_put_super+0x3f/0x1a0 fs/nilfs2/super.c:468 generic_shutdown_super+0x154/0x410 fs/super.c:491 kill_block_super+0x97/0xf0 fs/super.c:1427 deactivate_locked_super+0x94/0x160 fs/super.c:331 deactivate_super+0xad/0xd0 fs/super.c:362 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1186 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:169 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f6b3568ca17 Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffe43fbad78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f6b3568ca17 RDX: 00007ffe43fbae4b RSI: 000000000000000a RDI: 00007ffe43fbae40 RBP: 00007ffe43fbae40 R08: 00000000ffffffff R09: 00007ffe43fbac10 R10: 0000555555a728b3 R11: 0000000000000246 R12: 00007f6b356e55f6 R13: 00007ffe43fbbf00 R14: 0000555555a72810 R15: 00007ffe43fbbf40 Allocated by task 10229: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc mm/kasan/common.c:516 [inline] ____kasan_kmalloc mm/kasan/common.c:475 [inline] __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:525 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x25a/0x460 mm/slab.c:3559 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] nilfs_find_or_create_root+0x84/0x4d0 fs/nilfs2/the_nilfs.c:747 nilfs_attach_checkpoint+0xc1/0x4b0 fs/nilfs2/super.c:519 nilfs_fill_super fs/nilfs2/super.c:1064 [inline] nilfs_mount+0xb12/0xfb0 fs/nilfs2/super.c:1317 legacy_get_tree+0x105/0x220 fs/fs_context.c:610 vfs_get_tree+0x89/0x2f0 fs/super.c:1530 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1326/0x1e20 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5123: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:367 [inline] ____kasan_slab_free+0x13d/0x1a0 mm/kasan/common.c:329 kasan_slab_free include/linux/kasan.h:200 [inline] __cache_free mm/slab.c:3418 [inline] kfree+0x173/0x390 mm/slab.c:3786 nilfs_put_root+0xb1/0xd0 fs/nilfs2/the_nilfs.c:804 nilfs_clear_inode+0x29a/0x330 fs/nilfs2/inode.c:895 nilfs_evict_inode+0x318/0x440 fs/nilfs2/inode.c:908 evict+0x2ed/0x6b0 fs/inode.c:664 dispose_list+0x117/0x1e0 fs/inode.c:697 evict_inodes+0x352/0x450 fs/inode.c:747 generic_shutdown_super+0xab/0x410 fs/super.c:479 kill_block_super+0x97/0xf0 fs/super.c:1427 deactivate_locked_super+0x94/0x160 fs/super.c:331 deactivate_super+0xad/0xd0 fs/super.c:362 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1186 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:169 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x8f0 kernel/rcu/tree.c:3341 ip_ma_put net/ipv4/igmp.c:171 [inline] ip_ma_put+0x112/0x170 net/ipv4/igmp.c:167 __ip_mc_dec_group+0x426/0x510 net/ipv4/igmp.c:1694 inetdev_event+0x933/0x1610 net/ipv4/devinet.c:1588 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] dev_close_many+0x2ff/0x630 net/core/dev.c:1545 dev_close net/core/dev.c:1567 [inline] dev_close+0x16d/0x210 net/core/dev.c:1561 __bond_release_one.cold+0x6d4/0xc68 drivers/net/bonding/bond_main.c:2454 bond_uninit+0x107/0x170 drivers/net/bonding/bond_main.c:5829 unregister_netdevice_many+0xd9e/0x1980 net/core/dev.c:10860 rtnl_delete_link net/core/rtnetlink.c:3123 [inline] rtnl_dellink+0x354/0xa90 net/core/rtnetlink.c:3174 rtnetlink_rcv_msg+0x43a/0xca0 net/core/rtnetlink.c:6091 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2540 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 __sys_sendmsg+0xf3/0x1c0 net/socket.c:2565 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x8f0 kernel/rcu/tree.c:3341 drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1716 unregister_sysctl_table fs/proc/proc_sysctl.c:1754 [inline] unregister_sysctl_table+0xc0/0x190 fs/proc/proc_sysctl.c:1729 __devinet_sysctl_unregister net/ipv4/devinet.c:2609 [inline] devinet_exit_net+0x186/0x280 net/ipv4/devinet.c:2754 ops_exit_list+0xb0/0x170 net/core/net_namespace.c:162 setup_net+0x7fb/0xc50 net/core/net_namespace.c:348 copy_net_ns+0x318/0x760 net/core/net_namespace.c:471 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x391/0x450 kernel/nsproxy.c:178 copy_process+0x307b/0x7110 kernel/fork.c:2257 kernel_clone+0xe7/0x8f0 kernel/fork.c:2672 __do_sys_clone3+0x1cd/0x2e0 kernel/fork.c:2964 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888025a5ec00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 48 bytes inside of 256-byte region [ffff888025a5ec00, ffff888025a5ed00) The buggy address belongs to the physical page: page:ffffea0000969780 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25a5e flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000081fc08 ffff888011841650 ffff888011840500 raw: 0000000000000000 ffff888025a5e000 0000000100000008 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 3637, tgid 3637 (syz-executor.0), ts 217217734627, free_ts 217204696762 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5549 __alloc_pages_node include/linux/gfp.h:243 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x360 mm/slab.c:2569 cache_alloc_refill+0x27f/0x380 mm/slab.c:2942 ____cache_alloc mm/slab.c:3018 [inline] ____cache_alloc mm/slab.c:3001 [inline] __do_cache_alloc mm/slab.c:3246 [inline] slab_alloc mm/slab.c:3287 [inline] __do_kmalloc mm/slab.c:3684 [inline] __kmalloc+0x3a1/0x4a0 mm/slab.c:3695 kmalloc include/linux/slab.h:605 [inline] kzalloc include/linux/slab.h:733 [inline] fib_create_info+0xdbe/0x4ac0 net/ipv4/fib_semantics.c:1449 fib_table_insert+0x195/0x1be0 net/ipv4/fib_trie.c:1236 fib_magic+0x455/0x540 net/ipv4/fib_frontend.c:1098 fib_add_ifaddr+0x49b/0x540 net/ipv4/fib_frontend.c:1142 fib_netdev_event+0x462/0x680 net/ipv4/fib_frontend.c:1480 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] __dev_notify_flags+0x110/0x2b0 net/core/dev.c:8577 dev_change_flags+0x112/0x170 net/core/dev.c:8615 do_setlink+0x9f1/0x3bb0 net/core/rtnetlink.c:2788 __rtnl_newlink+0xd6a/0x17e0 net/core/rtnetlink.c:3547 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1449 [inline] free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476 slab_destroy mm/slab.c:1615 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1635 cache_flusharray mm/slab.c:3389 [inline] ___cache_free+0x2a8/0x3d0 mm/slab.c:3452 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1b0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:727 [inline] slab_alloc_node mm/slab.c:3232 [inline] kmem_cache_alloc_node_trace+0x308/0x570 mm/slab.c:3601 kmalloc_node include/linux/slab.h:618 [inline] kzalloc_node include/linux/slab.h:744 [inline] alloc_worker+0x43/0x1c0 kernel/workqueue.c:1840 create_worker+0xd1/0x530 kernel/workqueue.c:1937 maybe_create_worker kernel/workqueue.c:2107 [inline] manage_workers kernel/workqueue.c:2159 [inline] worker_thread+0xab6/0x1080 kernel/workqueue.c:2408 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Memory state around the buggy address: ffff888025a5eb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888025a5eb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888025a5ec00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888025a5ec80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888025a5ed00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================