================================================================== BUG: KASAN: slab-use-after-free in ext4_xattr_set_entry+0x179e/0x1e20 fs/ext4/xattr.c:1740 Read of size 260 at addr ffff88811a37e000 by task syz.2.19/5991 CPU: 0 UID: 0 PID: 5991 Comm: syz.2.19 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xba/0x230 mm/kasan/report.c:482 kasan_report+0x117/0x150 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200 __asan_memmove+0x29/0x70 mm/kasan/shadow.c:94 ext4_xattr_set_entry+0x179e/0x1e20 fs/ext4/xattr.c:1740 ext4_xattr_block_set+0x636/0x2b00 fs/ext4/xattr.c:1961 ext4_xattr_set_handle+0xdc2/0x14d0 fs/ext4/xattr.c:2432 ext4_xattr_set+0x255/0x340 fs/ext4/xattr.c:2560 __vfs_removexattr+0x431/0x470 fs/xattr.c:518 __vfs_removexattr_locked+0xe2/0x280 fs/xattr.c:553 vfs_removexattr+0x7f/0x230 fs/xattr.c:575 ovl_do_removexattr fs/overlayfs/overlayfs.h:335 [inline] ovl_removexattr fs/overlayfs/overlayfs.h:343 [inline] ovl_make_workdir fs/overlayfs/super.c:760 [inline] ovl_get_workdir fs/overlayfs/super.c:840 [inline] ovl_fill_super_creds fs/overlayfs/super.c:1453 [inline] ovl_fill_super+0x4c09/0x5e00 fs/overlayfs/super.c:1564 vfs_get_super fs/super.c:1327 [inline] get_tree_nodev+0xbb/0x150 fs/super.c:1346 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7facfdf9c799 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007facfd5fe028 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007facfe215fa0 RCX: 00007facfdf9c799 RDX: 0000200000000440 RSI: 0000200000000100 RDI: 0000000000000000 RBP: 00007facfe032bd9 R08: 0000200000000280 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007facfe216038 R14: 00007facfe215fa0 R15: 00007ffdb6825fe8 Allocated by task 5825: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 unpoison_slab_object mm/kasan/common.c:340 [inline] __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:366 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4515 [inline] slab_alloc_node mm/slub.c:4844 [inline] kmem_cache_alloc_noprof+0x2bc/0x650 mm/slub.c:4851 __kernfs_new_node+0xe9/0x8e0 fs/kernfs/dir.c:637 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:718 __kernfs_create_file+0x4b/0x2e0 fs/kernfs/file.c:1057 sysfs_add_file_mode_ns+0x238/0x300 fs/sysfs/file.c:313 create_files fs/sysfs/group.c:82 [inline] internal_create_group+0x673/0x1180 fs/sysfs/group.c:189 internal_create_groups fs/sysfs/group.c:229 [inline] sysfs_create_groups+0x59/0x120 fs/sysfs/group.c:255 device_add_groups drivers/base/core.c:2836 [inline] device_add_attrs+0xdd/0x5b0 drivers/base/core.c:2900 device_add+0x496/0xb70 drivers/base/core.c:3643 netdev_register_kobject+0x178/0x310 net/core/net-sysfs.c:2358 register_netdevice+0x12c0/0x1cf0 net/core/dev.c:11422 __ip_tunnel_create+0x3e8/0x560 net/ipv4/ip_tunnel.c:268 ip_tunnel_init_net+0x2e7/0x840 net/ipv4/ip_tunnel.c:1147 ops_init+0x35c/0x5c0 net/core/net_namespace.c:137 setup_net+0x118/0x340 net/core/net_namespace.c:446 copy_net_ns+0x50e/0x730 net/core/net_namespace.c:581 create_new_namespaces+0x3e7/0x6a0 kernel/nsproxy.c:130 unshare_nsproxy_namespaces+0x11a/0x160 kernel/nsproxy.c:226 ksys_unshare+0x51d/0x930 kernel/fork.c:3174 __do_sys_unshare kernel/fork.c:3245 [inline] __se_sys_unshare kernel/fork.c:3243 [inline] __x64_sys_unshare+0x38/0x50 kernel/fork.c:3243 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 15: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2692 [inline] slab_free mm/slub.c:6143 [inline] kmem_cache_free+0x187/0x630 mm/slub.c:6273 rcu_do_batch kernel/rcu/tree.c:2617 [inline] rcu_core+0x7cd/0x1070 kernel/rcu/tree.c:2869 handle_softirqs+0x22a/0x870 kernel/softirq.c:622 run_ksoftirqd+0x36/0x60 kernel/softirq.c:1063 smpboot_thread_fn+0x541/0xa50 kernel/smpboot.c:160 kthread+0x388/0x470 kernel/kthread.c:467 ret_from_fork+0x51e/0xb90 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Last potentially related work creation: kasan_save_stack+0x3e/0x60 mm/kasan/common.c:57 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:556 __call_rcu_common kernel/rcu/tree.c:3131 [inline] call_rcu+0xee/0x890 kernel/rcu/tree.c:3251 kernfs_put+0x18e/0x470 fs/kernfs/dir.c:591 kernfs_remove_by_name_ns+0xb7/0x130 fs/kernfs/dir.c:1723 kernfs_remove_by_name include/linux/kernfs.h:633 [inline] remove_files fs/sysfs/group.c:28 [inline] sysfs_remove_group+0xfc/0x2e0 fs/sysfs/group.c:328 sysfs_remove_groups+0x54/0xb0 fs/sysfs/group.c:352 device_remove_groups drivers/base/core.c:2843 [inline] device_remove_attrs+0x229/0x280 drivers/base/core.c:2979 device_del+0x51f/0x8f0 drivers/base/core.c:3877 unregister_netdevice_many_notify+0x1e0e/0x2370 net/core/dev.c:12447 ops_exit_rtnl_list net/core/net_namespace.c:187 [inline] ops_undo_list+0x3d3/0x940 net/core/net_namespace.c:248 cleanup_net+0x56b/0x800 net/core/net_namespace.c:704 process_one_work kernel/workqueue.c:3275 [inline] process_scheduled_works+0xb02/0x1830 kernel/workqueue.c:3358 worker_thread+0xa50/0xfc0 kernel/workqueue.c:3439 kthread+0x388/0x470 kernel/kthread.c:467 ret_from_fork+0x51e/0xb90 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff88811a37e000 which belongs to the cache kernfs_node_cache of size 176 The buggy address is located 0 bytes inside of freed 176-byte region [ffff88811a37e000, ffff88811a37e0b0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811a37ee10 pfn:0x11a37e flags: 0x17ff00000000200(workingset|node=0|zone=2|lastcpupid=0x7ff) page_type: f5(slab) raw: 017ff00000000200 ffff8881012d3dc0 ffffea000468fed0 ffffea000468df10 raw: ffff88811a37ee10 000000080011000a 00000000f5000000 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 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5822, tgid 5822 (syz-executor), ts 67128981798, free_ts 62919905097 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x231/0x280 mm/page_alloc.c:1889 prep_new_page mm/page_alloc.c:1897 [inline] get_page_from_freelist+0x24dc/0x2580 mm/page_alloc.c:3962 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5250 alloc_slab_page mm/slub.c:3269 [inline] allocate_slab+0x77/0x660 mm/slub.c:3458 new_slab mm/slub.c:3516 [inline] refill_objects+0x331/0x3c0 mm/slub.c:7153 refill_sheaf mm/slub.c:2818 [inline] __pcs_replace_empty_main+0x2b9/0x620 mm/slub.c:4592 alloc_from_pcs mm/slub.c:4695 [inline] slab_alloc_node mm/slub.c:4829 [inline] kmem_cache_alloc_noprof+0x37d/0x650 mm/slub.c:4851 __kernfs_new_node+0xe9/0x8e0 fs/kernfs/dir.c:637 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:718 __kernfs_create_file+0x4b/0x2e0 fs/kernfs/file.c:1057 sysfs_add_file_mode_ns+0x238/0x300 fs/sysfs/file.c:313 create_files fs/sysfs/group.c:82 [inline] internal_create_group+0x673/0x1180 fs/sysfs/group.c:189 internal_create_groups fs/sysfs/group.c:229 [inline] sysfs_create_groups+0x59/0x120 fs/sysfs/group.c:255 device_add_groups drivers/base/core.c:2836 [inline] device_add_attrs+0x1bf/0x5b0 drivers/base/core.c:2911 device_add+0x496/0xb70 drivers/base/core.c:3643 netdev_register_kobject+0x178/0x310 net/core/net-sysfs.c:2358 page last free pid 5809 tgid 5809 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1433 [inline] __free_frozen_pages+0xc2b/0xdb0 mm/page_alloc.c:2978 vfree+0x25a/0x400 mm/vmalloc.c:3479 kcov_put kernel/kcov.c:442 [inline] kcov_close+0x28/0x50 kernel/kcov.c:543 __fput+0x44f/0xa70 fs/file_table.c:469 fput_close_sync+0x11f/0x240 fs/file_table.c:574 __do_sys_close fs/open.c:1509 [inline] __se_sys_close fs/open.c:1494 [inline] __x64_sys_close+0x7e/0x110 fs/open.c:1494 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88811a37df00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88811a37df80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88811a37e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811a37e080: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb ffff88811a37e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================