================================================================== BUG: KASAN: slab-use-after-free in __ref_is_percpu include/linux/percpu-refcount.h:174 [inline] BUG: KASAN: slab-use-after-free in percpu_ref_put_many include/linux/percpu-refcount.h:332 [inline] BUG: KASAN: slab-use-after-free in percpu_ref_put+0xda/0x250 include/linux/percpu-refcount.h:351 Read of size 8 at addr ffff88805552e0b0 by task kworker/u4:9/1135 CPU: 0 UID: 0 PID: 1135 Comm: kworker/u4:9 Not tainted 6.14.0-syzkaller-10167-g93d52288679e #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: loop0 loop_workfn Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0x16e/0x5b0 mm/kasan/report.c:521 kasan_report+0x143/0x180 mm/kasan/report.c:634 __ref_is_percpu include/linux/percpu-refcount.h:174 [inline] percpu_ref_put_many include/linux/percpu-refcount.h:332 [inline] percpu_ref_put+0xda/0x250 include/linux/percpu-refcount.h:351 blk_update_request+0x5e5/0x1160 block/blk-mq.c:983 blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1145 loop_handle_cmd drivers/block/loop.c:1960 [inline] loop_process_work+0x1bdf/0x21d0 drivers/block/loop.c:1978 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xac3/0x18e0 kernel/workqueue.c:3319 worker_thread+0x870/0xd50 kernel/workqueue.c:3400 kthread+0x7b7/0x940 kernel/kthread.c:464 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 5324: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x9d/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x236/0x370 mm/slub.c:4349 kmalloc_noprof include/linux/slab.h:902 [inline] kzalloc_noprof include/linux/slab.h:1036 [inline] __bch2_dev_alloc+0x57/0xa60 fs/bcachefs/super.c:1327 bch2_dev_alloc+0xd6/0x180 fs/bcachefs/super.c:1394 bch2_fs_alloc fs/bcachefs/super.c:958 [inline] bch2_fs_open+0x315f/0x32a0 fs/bcachefs/super.c:2182 bch2_fs_get_tree+0x77b/0x18d0 fs/bcachefs/fs.c:2172 vfs_get_tree+0x90/0x2b0 fs/super.c:1759 do_new_mount+0x2cf/0xb70 fs/namespace.c:3878 do_mount fs/namespace.c:4218 [inline] __do_sys_mount fs/namespace.c:4429 [inline] __se_sys_mount+0x38c/0x400 fs/namespace.c:4406 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5324: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2376 [inline] slab_free mm/slub.c:4633 [inline] kfree+0x198/0x430 mm/slub.c:4832 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x22f/0x480 lib/kobject.c:737 bch2_fs_free+0x27b/0x3c0 fs/bcachefs/super.c:677 deactivate_locked_super+0xc4/0x130 fs/super.c:473 bch2_fs_get_tree+0xd41/0x18d0 fs/bcachefs/fs.c:2294 vfs_get_tree+0x90/0x2b0 fs/super.c:1759 do_new_mount+0x2cf/0xb70 fs/namespace.c:3878 do_mount fs/namespace.c:4218 [inline] __do_sys_mount fs/namespace.c:4429 [inline] __se_sys_mount+0x38c/0x400 fs/namespace.c:4406 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xbf/0xd0 mm/kasan/generic.c:548 insert_work+0x3e/0x330 kernel/workqueue.c:2183 __queue_work+0xda3/0x10a0 kernel/workqueue.c:2341 queue_work_on+0x1c4/0x380 kernel/workqueue.c:2392 queue_work include/linux/workqueue.h:662 [inline] bch2_dev_do_invalidates+0x17a/0x1f0 fs/bcachefs/alloc_background.c:2274 bch2_do_invalidates+0x29/0x60 fs/bcachefs/alloc_background.c:2285 __bch2_fs_read_write+0x386/0x3b0 fs/bcachefs/super.c:510 bch2_run_recovery_pass+0xf0/0x1e0 fs/bcachefs/recovery_passes.c:226 bch2_run_recovery_passes+0x2ad/0xa90 fs/bcachefs/recovery_passes.c:291 bch2_fs_recovery+0x292a/0x3e20 fs/bcachefs/recovery.c:936 bch2_fs_start+0x37c/0x620 fs/bcachefs/super.c:1057 bch2_fs_get_tree+0x1270/0x18d0 fs/bcachefs/fs.c:2253 vfs_get_tree+0x90/0x2b0 fs/super.c:1759 do_new_mount+0x2cf/0xb70 fs/namespace.c:3878 do_mount fs/namespace.c:4218 [inline] __do_sys_mount fs/namespace.c:4429 [inline] __se_sys_mount+0x38c/0x400 fs/namespace.c:4406 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Second to last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xbf/0xd0 mm/kasan/generic.c:548 insert_work+0x3e/0x330 kernel/workqueue.c:2183 __queue_work+0xda3/0x10a0 kernel/workqueue.c:2341 queue_work_on+0x1c4/0x380 kernel/workqueue.c:2392 queue_work include/linux/workqueue.h:662 [inline] bch2_dev_do_discards+0x17a/0x1f0 fs/bcachefs/alloc_background.c:1967 bch2_do_discards+0x29/0x60 fs/bcachefs/alloc_background.c:1978 __bch2_fs_read_write+0x37e/0x3b0 fs/bcachefs/super.c:509 bch2_run_recovery_pass+0xf0/0x1e0 fs/bcachefs/recovery_passes.c:226 bch2_run_recovery_passes+0x2ad/0xa90 fs/bcachefs/recovery_passes.c:291 bch2_fs_recovery+0x292a/0x3e20 fs/bcachefs/recovery.c:936 bch2_fs_start+0x37c/0x620 fs/bcachefs/super.c:1057 bch2_fs_get_tree+0x1270/0x18d0 fs/bcachefs/fs.c:2253 vfs_get_tree+0x90/0x2b0 fs/super.c:1759 do_new_mount+0x2cf/0xb70 fs/namespace.c:3878 do_mount fs/namespace.c:4218 [inline] __do_sys_mount fs/namespace.c:4429 [inline] __se_sys_mount+0x38c/0x400 fs/namespace.c:4406 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88805552e000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 176 bytes inside of freed 4096-byte region [ffff88805552e000, ffff88805552f000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x55528 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801b042140 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801b042140 dead000000000122 0000000000000000 head: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000 head: 04fff00000000003 ffffea0001554a01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5304, tgid 5304 (udevd), ts 59491990129, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0x3695/0x37e0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x2c5/0x7b0 mm/page_alloc.c:4740 alloc_pages_mpol+0x339/0x690 mm/mempolicy.c:2301 alloc_slab_page mm/slub.c:2446 [inline] allocate_slab+0x8f/0x3a0 mm/slub.c:2610 new_slab mm/slub.c:2663 [inline] ___slab_alloc+0xc3b/0x1500 mm/slub.c:3849 __slab_alloc+0x58/0xa0 mm/slub.c:3939 __slab_alloc_node mm/slub.c:4014 [inline] slab_alloc_node mm/slub.c:4175 [inline] __do_kmalloc_node mm/slub.c:4317 [inline] __kmalloc_noprof+0x2ea/0x4d0 mm/slub.c:4330 kmalloc_noprof include/linux/slab.h:906 [inline] tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path2_perm+0x37d/0x8e0 security/tomoyo/file.c:923 tomoyo_path_rename+0x19a/0x1f0 security/tomoyo/tomoyo.c:300 security_path_rename+0x266/0x4e0 security/security.c:2026 do_renameat2+0x847/0x1290 fs/namei.c:5222 __do_sys_rename fs/namei.c:5282 [inline] __se_sys_rename fs/namei.c:5280 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5280 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page_owner free stack trace missing Memory state around the buggy address: ffff88805552df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805552e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805552e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805552e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805552e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================