================================================================== BUG: KASAN: use-after-free in css_put include/linux/cgroup.h:406 [inline] BUG: KASAN: use-after-free in cgroup_put include/linux/cgroup.h:435 [inline] BUG: KASAN: use-after-free in css_free_rwork_fn+0x548/0x680 kernel/cgroup/cgroup.c:4998 Read of size 4 at addr ffff888116ac8054 by task kworker/0:30/14230 CPU: 0 PID: 14230 Comm: kworker/0:30 Not tainted 5.10.77-syzkaller-01258-g76698ea35fd3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: cgroup_destroy css_free_rwork_fn Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x8d/0x3d0 mm/kasan/report.c:233 __kasan_report+0x142/0x220 mm/kasan/report.c:419 kasan_report+0x51/0x70 mm/kasan/report.c:436 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 css_put include/linux/cgroup.h:406 [inline] cgroup_put include/linux/cgroup.h:435 [inline] css_free_rwork_fn+0x548/0x680 kernel/cgroup/cgroup.c:4998 process_one_work+0x6b4/0xfb0 kernel/workqueue.c:2289 worker_thread+0xb15/0x1600 kernel/workqueue.c:2435 kthread+0x371/0x390 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Allocated by task 11550: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] __kmalloc+0x22a/0x3d0 mm/slub.c:4034 kmalloc include/linux/slab.h:557 [inline] kzalloc+0x1a/0x20 include/linux/slab.h:664 cgroup_create kernel/cgroup/cgroup.c:5243 [inline] cgroup_mkdir+0x322/0x1a40 kernel/cgroup/cgroup.c:5393 kernfs_iop_mkdir+0x1b0/0x2b0 fs/kernfs/dir.c:1127 vfs_mkdir+0x435/0x610 fs/namei.c:3725 ovl_do_mkdir fs/overlayfs/overlayfs.h:159 [inline] ovl_mkdir_real fs/overlayfs/dir.c:146 [inline] ovl_create_real+0x160/0x380 fs/overlayfs/dir.c:193 ovl_workdir_create+0x415/0x5e0 fs/overlayfs/super.c:767 ovl_make_workdir fs/overlayfs/super.c:1311 [inline] ovl_get_workdir fs/overlayfs/super.c:1448 [inline] ovl_fill_super+0x3887/0x6680 fs/overlayfs/super.c:1988 mount_nodev+0x57/0xf0 fs/super.c:1465 ovl_mount+0x2c/0x40 fs/overlayfs/super.c:2072 legacy_get_tree+0xf0/0x190 fs/fs_context.c:592 vfs_get_tree+0x89/0x270 fs/super.c:1549 do_new_mount fs/namespace.c:2899 [inline] path_mount+0x1975/0x2ab0 fs/namespace.c:3229 do_mount fs/namespace.c:3242 [inline] __do_sys_mount fs/namespace.c:3450 [inline] __se_sys_mount+0x2f7/0x3b0 fs/namespace.c:3427 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3427 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 14230: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1596 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1622 slab_free mm/slub.c:3204 [inline] kfree+0xd5/0x320 mm/slub.c:4192 css_free_rwork_fn+0x3f0/0x680 kernel/cgroup/cgroup.c:5020 process_one_work+0x6b4/0xfb0 kernel/workqueue.c:2289 worker_thread+0xb15/0x1600 kernel/workqueue.c:2435 kthread+0x371/0x390 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345 insert_work+0x56/0x330 kernel/workqueue.c:1340 __queue_work+0x951/0xda0 kernel/workqueue.c:1506 rcu_work_rcufn+0x47/0x50 kernel/workqueue.c:1749 rcu_do_batch+0x4cd/0xb40 kernel/rcu/tree.c:2484 rcu_core+0x822/0x10d0 kernel/rcu/tree.c:2721 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2734 __do_softirq+0x27e/0x598 kernel/softirq.c:305 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2962 [inline] call_rcu+0x134/0x1470 kernel/rcu/tree.c:3036 queue_rcu_work+0x79/0x90 kernel/workqueue.c:1769 css_release_work_fn+0x4cf/0x640 kernel/cgroup/cgroup.c:5084 process_one_work+0x6b4/0xfb0 kernel/workqueue.c:2289 worker_thread+0xb15/0x1600 kernel/workqueue.c:2435 kthread+0x371/0x390 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 The buggy address belongs to the object at ffff888116ac8000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 84 bytes inside of 4096-byte region [ffff888116ac8000, ffff888116ac9000) The buggy address belongs to the page: page:ffffea00045ab200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x116ac8 head:ffffea00045ab200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100042c00 raw: 0000000000000000 0000000000040004 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 6496, ts 347434975695, free_ts 344795447067 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0xa74/0xa90 mm/page_alloc.c:4063 __alloc_pages_nodemask+0x3c8/0x820 mm/page_alloc.c:5106 alloc_slab_page mm/slub.c:1807 [inline] allocate_slab+0x6b/0x350 mm/slub.c:1809 new_slab mm/slub.c:1870 [inline] new_slab_objects mm/slub.c:2629 [inline] ___slab_alloc+0x143/0x2f0 mm/slub.c:2792 __slab_alloc mm/slub.c:2832 [inline] slab_alloc_node mm/slub.c:2914 [inline] slab_alloc mm/slub.c:2956 [inline] __kmalloc_track_caller+0x299/0x3b0 mm/slub.c:4535 kmemdup+0x24/0x50 mm/util.c:131 __devinet_sysctl_register+0xae/0x370 net/ipv4/devinet.c:2560 devinet_sysctl_register+0x169/0x1e0 net/ipv4/devinet.c:2612 inetdev_init+0x240/0x590 net/ipv4/devinet.c:276 inetdev_event+0x205/0x11b0 net/ipv4/devinet.c:1531 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x8e/0xf0 kernel/notifier.c:410 call_netdevice_notifiers_info net/core/dev.c:2054 [inline] call_netdevice_notifiers_extack net/core/dev.c:2066 [inline] call_netdevice_notifiers net/core/dev.c:2080 [inline] register_netdevice+0x1502/0x1ad0 net/core/dev.c:10135 register_netdev+0x3c/0x50 net/core/dev.c:10235 ip6_tnl_init_net+0x2d8/0x390 net/ipv6/ip6_tunnel.c:2317 ops_init+0x199/0x380 net/core/net_namespace.c:152 setup_net+0x21b/0xa70 net/core/net_namespace.c:342 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1331 [inline] __free_pages_ok+0xbe7/0xc20 mm/page_alloc.c:1611 free_the_page mm/page_alloc.c:5167 [inline] __free_pages+0x2d6/0x4a0 mm/page_alloc.c:5173 __free_slab+0xdf/0x1a0 mm/slub.c:1895 free_slab mm/slub.c:1910 [inline] discard_slab mm/slub.c:1916 [inline] unfreeze_partials+0x17d/0x1b0 mm/slub.c:2410 put_cpu_partial+0xc8/0x190 mm/slub.c:2446 __slab_free+0x2eb/0x4e0 mm/slub.c:3096 do_slab_free mm/slub.c:3192 [inline] ___cache_free+0x131/0x150 mm/slub.c:3211 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146 qlist_free_all mm/kasan/quarantine.c:165 [inline] kasan_quarantine_reduce+0x178/0x1d0 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:583 [inline] slab_alloc_node mm/slub.c:2948 [inline] slab_alloc mm/slub.c:2956 [inline] kmem_cache_alloc_trace+0x1a5/0x3a0 mm/slub.c:2973 kmalloc include/linux/slab.h:552 [inline] syslog_print kernel/printk/printk.c:1485 [inline] do_syslog+0xfef/0x1430 kernel/printk/printk.c:1642 __do_sys_syslog kernel/printk/printk.c:1734 [inline] __se_sys_syslog kernel/printk/printk.c:1732 [inline] __x64_sys_syslog+0x7c/0x90 kernel/printk/printk.c:1732 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Memory state around the buggy address: ffff888116ac7f00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc ffff888116ac7f80: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc >ffff888116ac8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888116ac8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888116ac8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 1138d9067 P4D 1138d9067 PUD 172342067 PMD 0 Oops: 0002 [#1] PREEMPT SMP KASAN CPU: 0 PID: 14230 Comm: kworker/0:30 Tainted: G B 5.10.77-syzkaller-01258-g76698ea35fd3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: cgroup_destroy css_free_rwork_fn RIP: 0010:arch_atomic64_sub_and_test arch/x86/include/asm/atomic64_64.h:76 [inline] RIP: 0010:atomic64_sub_and_test include/asm-generic/atomic-instrumented.h:1549 [inline] RIP: 0010:atomic_long_sub_and_test include/asm-generic/atomic-long.h:461 [inline] RIP: 0010:percpu_ref_put_many include/linux/percpu-refcount.h:321 [inline] RIP: 0010:percpu_ref_put include/linux/percpu-refcount.h:338 [inline] RIP: 0010:css_put include/linux/cgroup.h:407 [inline] RIP: 0010:cgroup_put include/linux/cgroup.h:435 [inline] RIP: 0010:css_free_rwork_fn+0x42c/0x680 kernel/cgroup/cgroup.c:4998 Code: 18 4d 89 ee 49 c1 ee 03 43 80 3c 26 00 74 08 4c 89 ef e8 47 42 40 00 49 8b 5d 00 48 89 df be 08 00 00 00 e8 46 44 40 00 31 f6 48 83 2b 01 0f 94 c3 40 0f 94 c6 31 ff e8 a1 70 06 00 84 db 0f RSP: 0018:ffffc900040f7cf0 EFLAGS: 00010246 RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff81668a8a RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900040f7d28 R08: ffffffff816687ce R09: fffffbfff0dc79b9 R10: fffffbfff0dc79b9 R11: 0000000000000000 R12: dffffc0000000000 R13: ffff888116ac8018 R14: 1ffff11022d59003 R15: ffff888116ac8010 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000153620000 CR4: 00000000003526b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: process_one_work+0x6b4/0xfb0 kernel/workqueue.c:2289 worker_thread+0xb15/0x1600 kernel/workqueue.c:2435 kthread+0x371/0x390 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Modules linked in: CR2: 0000000000000000 ---[ end trace bdf3537513addfae ]--- RIP: 0010:arch_atomic64_sub_and_test arch/x86/include/asm/atomic64_64.h:76 [inline] RIP: 0010:atomic64_sub_and_test include/asm-generic/atomic-instrumented.h:1549 [inline] RIP: 0010:atomic_long_sub_and_test include/asm-generic/atomic-long.h:461 [inline] RIP: 0010:percpu_ref_put_many include/linux/percpu-refcount.h:321 [inline] RIP: 0010:percpu_ref_put include/linux/percpu-refcount.h:338 [inline] RIP: 0010:css_put include/linux/cgroup.h:407 [inline] RIP: 0010:cgroup_put include/linux/cgroup.h:435 [inline] RIP: 0010:css_free_rwork_fn+0x42c/0x680 kernel/cgroup/cgroup.c:4998 Code: 18 4d 89 ee 49 c1 ee 03 43 80 3c 26 00 74 08 4c 89 ef e8 47 42 40 00 49 8b 5d 00 48 89 df be 08 00 00 00 e8 46 44 40 00 31 f6 48 83 2b 01 0f 94 c3 40 0f 94 c6 31 ff e8 a1 70 06 00 84 db 0f RSP: 0018:ffffc900040f7cf0 EFLAGS: 00010246 RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff81668a8a RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900040f7d28 R08: ffffffff816687ce R09: fffffbfff0dc79b9 R10: fffffbfff0dc79b9 R11: 0000000000000000 R12: dffffc0000000000 R13: ffff888116ac8018 R14: 1ffff11022d59003 R15: ffff888116ac8010 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000153620000 CR4: 00000000003526b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 18 4d 89 sbb %cl,-0x77(%rbp) 3: ee out %al,(%dx) 4: 49 c1 ee 03 shr $0x3,%r14 8: 43 80 3c 26 00 cmpb $0x0,(%r14,%r12,1) d: 74 08 je 0x17 f: 4c 89 ef mov %r13,%rdi 12: e8 47 42 40 00 callq 0x40425e 17: 49 8b 5d 00 mov 0x0(%r13),%rbx 1b: 48 89 df mov %rbx,%rdi 1e: be 08 00 00 00 mov $0x8,%esi 23: e8 46 44 40 00 callq 0x40446e 28: 31 f6 xor %esi,%esi * 2a: f0 48 83 2b 01 lock subq $0x1,(%rbx) <-- trapping instruction 2f: 0f 94 c3 sete %bl 32: 40 0f 94 c6 sete %sil 36: 31 ff xor %edi,%edi 38: e8 a1 70 06 00 callq 0x670de 3d: 84 db test %bl,%bl 3f: 0f .byte 0xf