NILFS (loop5): discard dirty page: offset=8192, ino=6 NILFS (loop5): discard dirty block: blocknr=25, size=4096 NILFS (loop5): disposed unprocessed dirty file(s) when detaching log writer ================================================================== BUG: KASAN: slab-use-after-free in nilfs_load_inode_block+0x2c9/0x310 fs/nilfs2/inode.c:1030 Read of size 8 at addr ffff88802ad39a30 by task syz-executor.5/5062 CPU: 0 PID: 5062 Comm: syz-executor.5 Not tainted 6.4.0-rc2-next-20230515-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:571 nilfs_load_inode_block+0x2c9/0x310 fs/nilfs2/inode.c:1030 __nilfs_mark_inode_dirty+0x78/0x240 fs/nilfs2/inode.c:1107 nilfs_dirty_inode+0x195/0x260 fs/nilfs2/inode.c:1148 __mark_inode_dirty+0x1e0/0xd60 fs/fs-writeback.c:2430 mark_inode_dirty_sync include/linux/fs.h:2149 [inline] iput fs/inode.c:1770 [inline] iput+0xb1/0x7a0 fs/inode.c:1759 nilfs_dispose_list+0x497/0x6e0 fs/nilfs2/segment.c:816 nilfs_detach_log_writer+0x733/0xa10 fs/nilfs2/segment.c:2852 nilfs_put_super+0x43/0x1b0 fs/nilfs2/super.c:477 generic_shutdown_super+0x158/0x480 fs/super.c:500 kill_block_super+0xa1/0x100 fs/super.c:1407 deactivate_locked_super+0x98/0x160 fs/super.c:331 deactivate_super+0xb1/0xd0 fs/super.c:362 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1177 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f8ceea8d5d7 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:00007ffe3e0da118 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f8ceea8d5d7 RDX: 00007ffe3e0da1ea RSI: 000000000000000a RDI: 00007ffe3e0da1e0 RBP: 00007ffe3e0da1e0 R08: 00000000ffffffff R09: 00007ffe3e0d9fb0 R10: 0000555555606873 R11: 0000000000000246 R12: 00007f8ceeae6cdc R13: 00007ffe3e0db2a0 R14: 0000555555606810 R15: 00007ffe3e0db2e0 Allocated by task 1588: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] ____kasan_kmalloc mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] nilfs_find_or_create_root+0x88/0x4d0 fs/nilfs2/the_nilfs.c:810 nilfs_attach_checkpoint+0xc5/0x4d0 fs/nilfs2/super.c:529 nilfs_fill_super fs/nilfs2/super.c:1074 [inline] nilfs_mount+0xbc9/0x1160 fs/nilfs2/super.c:1326 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x350 fs/super.c:1510 do_new_mount fs/namespace.c:3039 [inline] path_mount+0x134b/0x1e40 fs/namespace.c:3369 do_mount fs/namespace.c:3382 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x283/0x300 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5062: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0xaf/0x2d0 mm/slub.c:3799 nilfs_put_root+0xb5/0xe0 fs/nilfs2/the_nilfs.c:867 nilfs_segctor_destroy fs/nilfs2/segment.c:2775 [inline] nilfs_detach_log_writer+0x597/0xa10 fs/nilfs2/segment.c:2838 nilfs_put_super+0x43/0x1b0 fs/nilfs2/super.c:477 generic_shutdown_super+0x158/0x480 fs/super.c:500 kill_block_super+0xa1/0x100 fs/super.c:1407 deactivate_locked_super+0x98/0x160 fs/super.c:331 deactivate_super+0xb1/0xd0 fs/super.c:362 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1177 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491 kvfree_call_rcu+0x70/0xbc0 kernel/rcu/tree.c:3368 drop_sysctl_table+0x3c2/0x4e0 fs/proc/proc_sysctl.c:1695 unregister_sysctl_table.part.0+0x9c/0x1b0 fs/proc/proc_sysctl.c:1733 unregister_sysctl_table+0x35/0x40 fs/proc/proc_sysctl.c:1713 unix_sysctl_unregister+0x5c/0x90 net/unix/sysctl_net_unix.c:57 unix_net_exit+0x69/0xb0 net/unix/af_unix.c:3659 ops_exit_list+0xb0/0x170 net/core/net_namespace.c:170 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:614 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2407 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2554 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491 kvfree_call_rcu+0x70/0xbc0 kernel/rcu/tree.c:3368 drop_sysctl_table+0x3c2/0x4e0 fs/proc/proc_sysctl.c:1695 unregister_sysctl_table.part.0+0x9c/0x1b0 fs/proc/proc_sysctl.c:1733 unregister_sysctl_table+0x35/0x40 fs/proc/proc_sysctl.c:1713 mpls_dev_sysctl_unregister net/mpls/af_mpls.c:1445 [inline] mpls_dev_notify+0x672/0x9a0 net/mpls/af_mpls.c:1657 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1935 call_netdevice_notifiers_extack net/core/dev.c:1973 [inline] call_netdevice_notifiers net/core/dev.c:1987 [inline] unregister_netdevice_many_notify+0x75f/0x18c0 net/core/dev.c:10882 ip_tunnel_delete_nets+0x2c2/0x3a0 net/ipv4/ip_tunnel.c:1144 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175 setup_net+0x7fb/0xc50 net/core/net_namespace.c:362 copy_net_ns+0x4ee/0x8e0 net/core/net_namespace.c:491 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x410/0x500 kernel/nsproxy.c:179 copy_process+0x322a/0x7600 kernel/fork.c:2506 kernel_clone+0xeb/0x890 kernel/fork.c:2914 __do_sys_clone+0xba/0x100 kernel/fork.c:3057 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88802ad39a00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 48 bytes inside of freed 256-byte region [ffff88802ad39a00, ffff88802ad39b00) The buggy address belongs to the physical page: page:ffffea0000ab4e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2ad38 head:ffffea0000ab4e00 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012441b40 ffffea00009bce00 dead000000000002 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5062, tgid 5062 (syz-executor.5), ts 375619217698, free_ts 375380380448 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0xf67/0x2a80 mm/page_alloc.c:3539 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4805 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x28e/0x380 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3192 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291 __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0x4e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] kzalloc include/linux/slab.h:680 [inline] fib_create_info+0xdbf/0x4c00 net/ipv4/fib_semantics.c:1454 fib_table_insert+0x199/0x1be0 net/ipv4/fib_trie.c:1236 fib_magic+0x493/0x580 net/ipv4/fib_frontend.c:1104 fib_add_ifaddr+0x16f/0x560 net/ipv4/fib_frontend.c:1126 fib_netdev_event+0x38c/0x6f0 net/ipv4/fib_frontend.c:1486 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1935 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x4dd/0xb90 mm/page_alloc.c:2600 free_unref_page+0x33/0x370 mm/page_alloc.c:2695 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:711 [inline] slab_alloc_node mm/slub.c:3451 [inline] __kmem_cache_alloc_node+0x17c/0x320 mm/slub.c:3490 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1057 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] nsim_fib6_rt_create drivers/net/netdevsim/fib.c:547 [inline] nsim_fib6_rt_insert drivers/net/netdevsim/fib.c:752 [inline] nsim_fib6_event drivers/net/netdevsim/fib.c:856 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:889 [inline] nsim_fib_event_work+0x121c/0x24a0 drivers/net/netdevsim/fib.c:1492 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2407 process_scheduled_works kernel/workqueue.c:2470 [inline] worker_thread+0x881/0x10c0 kernel/workqueue.c:2556 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Memory state around the buggy address: ffff88802ad39900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802ad39980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802ad39a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802ad39a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802ad39b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================