================================================================== 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+0x545/0x680 kernel/cgroup/cgroup.c:5066 Read of size 4 at addr ffff888143248054 by task kworker/0:212/27277 CPU: 0 PID: 27277 Comm: kworker/0:212 Not tainted 5.10.118-syzkaller-00163-gfa7f6a5f56d9 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 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+0x81/0x3c0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x1a4/0x1f0 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+0x545/0x680 kernel/cgroup/cgroup.c:5066 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Allocated by task 15908: 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+0x1f7/0x360 mm/slub.c:4042 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:664 [inline] cgroup_create kernel/cgroup/cgroup.c:5311 [inline] cgroup_mkdir+0x2d7/0x15c0 kernel/cgroup/cgroup.c:5461 kernfs_iop_mkdir+0x1ad/0x2b0 fs/kernfs/dir.c:1127 vfs_mkdir+0x435/0x610 fs/namei.c:3725 do_mkdirat+0x1b6/0x2d0 fs/namei.c:3748 __do_sys_mkdirat fs/namei.c:3759 [inline] __se_sys_mkdirat fs/namei.c:3757 [inline] __x64_sys_mkdirat+0x7b/0x90 fs/namei.c:3757 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 27277: 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+0x121/0x160 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:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 css_free_rwork_fn+0x3ed/0x680 kernel/cgroup/cgroup.c:5088 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 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+0xca/0xf0 mm/kasan/generic.c:345 insert_work+0x56/0x330 kernel/workqueue.c:1348 __queue_work+0x971/0xd30 kernel/workqueue.c:1514 rcu_work_rcufn+0x47/0x50 kernel/workqueue.c:1757 rcu_do_batch+0x59e/0xc40 kernel/rcu/tree.c:2485 rcu_core+0x59b/0xe30 kernel/rcu/tree.c:2726 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2739 __do_softirq+0x27e/0x596 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+0xca/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2967 [inline] call_rcu+0x140/0x1300 kernel/rcu/tree.c:3041 queue_rcu_work+0x7f/0xa0 kernel/workqueue.c:1777 css_release_work_fn+0x4cf/0x640 kernel/cgroup/cgroup.c:5152 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 The buggy address belongs to the object at ffff888143248000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 84 bytes inside of 4096-byte region [ffff888143248000, ffff888143249000) The buggy address belongs to the page: page:ffffea00050c9200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x143248 head:ffffea00050c9200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 ffffea0004af3800 0000000200000002 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 28969, ts 1792738996212, free_ts 1791423619430 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+0x745/0x760 mm/page_alloc.c:4067 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5117 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc_track_caller+0x23e/0x350 mm/slub.c:4545 __kmalloc_reserve net/core/skbuff.c:143 [inline] __alloc_skb+0xbe/0x580 net/core/skbuff.c:211 alloc_skb include/linux/skbuff.h:1101 [inline] nlmsg_new include/net/netlink.h:953 [inline] rtmsg_ifinfo_build_skb+0x7f/0x180 net/core/rtnetlink.c:3819 rtmsg_ifinfo_event net/core/rtnetlink.c:3855 [inline] rtmsg_ifinfo+0x77/0x120 net/core/rtnetlink.c:3864 register_netdevice+0x150f/0x1790 net/core/dev.c:10166 register_netdev+0x3c/0x50 net/core/dev.c:10245 sit_init_net+0x243/0x480 net/ipv6/sit.c:1914 ops_init+0x19e/0x390 net/core/net_namespace.c:152 setup_net+0x21b/0xa70 net/core/net_namespace.c:344 copy_net_ns+0x317/0x520 net/core/net_namespace.c:485 create_new_namespaces+0x425/0x710 kernel/nsproxy.c:110 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+0x7f8/0x830 mm/page_alloc.c:1611 free_the_page mm/page_alloc.c:5178 [inline] __free_pages+0x383/0x570 mm/page_alloc.c:5185 __free_slab+0xd3/0x190 mm/slub.c:1903 free_slab mm/slub.c:1918 [inline] discard_slab+0x29/0x40 mm/slub.c:1924 __slab_free+0x31d/0x3a0 mm/slub.c:3140 do_slab_free mm/slub.c:3200 [inline] ___cache_free+0x11f/0x140 mm/slub.c:3219 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146 qlist_free_all+0x4c/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x15a/0x170 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 include/../mm/slab.h:583 [inline] slab_alloc_node mm/slub.c:2956 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc+0x16c/0x300 mm/slub.c:2969 kmem_cache_alloc_node include/linux/slab.h:423 [inline] __alloc_skb+0x7e/0x580 net/core/skbuff.c:199 alloc_skb_fclone include/linux/skbuff.h:1151 [inline] sk_stream_alloc_skb+0x1e5/0xa80 net/ipv4/tcp.c:890 tcp_sendmsg_locked+0xd81/0x3be0 net/ipv4/tcp.c:1298 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1450 inet_sendmsg+0xa1/0xc0 net/ipv4/af_inet.c:821 Memory state around the buggy address: ffff888143247f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888143247f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888143248000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888143248080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888143248100: 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 0 P4D 0 Oops: 0002 [#1] PREEMPT SMP KASAN CPU: 0 PID: 27277 Comm: kworker/0:212 Tainted: G B 5.10.118-syzkaller-00163-gfa7f6a5f56d9 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 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+0x429/0x680 kernel/cgroup/cgroup.c:5066 Code: 18 4d 89 ee 49 c1 ee 03 43 80 3c 26 00 74 08 4c 89 ef e8 aa bb 40 00 49 8b 5d 00 48 89 df be 08 00 00 00 e8 a9 bd 40 00 31 f6 48 83 2b 01 0f 94 c3 40 0f 94 c6 31 ff e8 44 c3 06 00 84 db 0f RSP: 0018:ffffc90006c3fce0 EFLAGS: 00010246 RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff8165f2a7 RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90006c3fd18 R08: ffffffff8165efee R09: fffffbfff0d860f9 R10: fffffbfff0d860f9 R11: 1ffffffff0d860f8 R12: dffffc0000000000 R13: ffff888143248018 R14: 1ffff11028649003 R15: ffff888143248010 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000010ee9e000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Modules linked in: CR2: 0000000000000000 ---[ end trace 2d6df5ff1d9336c8 ]--- 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+0x429/0x680 kernel/cgroup/cgroup.c:5066 Code: 18 4d 89 ee 49 c1 ee 03 43 80 3c 26 00 74 08 4c 89 ef e8 aa bb 40 00 49 8b 5d 00 48 89 df be 08 00 00 00 e8 a9 bd 40 00 31 f6 48 83 2b 01 0f 94 c3 40 0f 94 c6 31 ff e8 44 c3 06 00 84 db 0f RSP: 0018:ffffc90006c3fce0 EFLAGS: 00010246 RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff8165f2a7 RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90006c3fd18 R08: ffffffff8165efee R09: fffffbfff0d860f9 R10: fffffbfff0d860f9 R11: 1ffffffff0d860f8 R12: dffffc0000000000 R13: ffff888143248018 R14: 1ffff11028649003 R15: ffff888143248010 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000010ee9e000 CR4: 00000000003506b0 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 aa bb 40 00 callq 0x40bbc1 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 a9 bd 40 00 callq 0x40bdd1 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 44 c3 06 00 callq 0x6c381 3d: 84 db test %bl,%bl 3f: 0f .byte 0xf