================================================================== BUG: KASAN: use-after-free in pool_ctr+0x86a/0xd50 drivers/md/dm-thin.c:3344 Read of size 8 at addr ffff888077601798 by task syz.1.447/6037 CPU: 0 PID: 6037 Comm: syz.1.447 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 Call Trace: dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0xa8/0x210 mm/kasan/report.c:420 kasan_report+0x10b/0x140 mm/kasan/report.c:524 pool_ctr+0x86a/0xd50 drivers/md/dm-thin.c:3344 dm_table_add_target+0x571/0xbc0 drivers/md/dm-table.c:733 populate_table drivers/md/dm-ioctl.c:1454 [inline] table_load+0x2ce/0x760 drivers/md/dm-ioctl.c:1496 ctl_ioctl drivers/md/dm-ioctl.c:2070 [inline] dm_ctl_ioctl+0xa9c/0xec0 drivers/md/dm-ioctl.c:2092 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7fd30a5a9519 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:00007fd30b3ce028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fd30a836090 RCX: 00007fd30a5a9519 RDX: 0000200000000240 RSI: 00000000c138fd09 RDI: 0000000000000004 RBP: 00007fd30a639136 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fd30a836128 R14: 00007fd30a836090 R15: 00007ffc4bd3eb68 Allocated by task 6037: kasan_save_stack mm/kasan/common.c:46 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:53 ____kasan_kmalloc mm/kasan/common.c:375 [inline] __kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:384 kmalloc_node include/linux/slab.h:585 [inline] open_table_device drivers/md/dm.c:723 [inline] dm_get_table_device+0x240/0x660 drivers/md/dm.c:792 dm_get_device+0x3c3/0x7f0 drivers/md/dm-table.c:381 pool_ctr+0x4a8/0xd50 drivers/md/dm-thin.c:3310 dm_table_add_target+0x571/0xbc0 drivers/md/dm-table.c:733 populate_table drivers/md/dm-ioctl.c:1454 [inline] table_load+0x2ce/0x760 drivers/md/dm-ioctl.c:1496 ctl_ioctl drivers/md/dm-ioctl.c:2070 [inline] dm_ctl_ioctl+0xa9c/0xec0 drivers/md/dm-ioctl.c:2092 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 6037: kasan_save_stack mm/kasan/common.c:46 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:53 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x126/0x1f0 mm/kasan/common.c:237 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1735 [inline] slab_free_freelist_hook+0x133/0x1b0 mm/slub.c:1761 slab_free mm/slub.c:3694 [inline] __kmem_cache_free+0xb6/0x200 mm/slub.c:3707 close_table_device drivers/md/dm.c:769 [inline] dm_put_table_device+0x223/0x270 drivers/md/dm.c:812 upgrade_mode drivers/md/dm-table.c:326 [inline] dm_get_device+0x61e/0x7f0 drivers/md/dm-table.c:391 pool_ctr+0x57f/0xd50 drivers/md/dm-thin.c:3317 dm_table_add_target+0x571/0xbc0 drivers/md/dm-table.c:733 populate_table drivers/md/dm-ioctl.c:1454 [inline] table_load+0x2ce/0x760 drivers/md/dm-ioctl.c:1496 ctl_ioctl drivers/md/dm-ioctl.c:2070 [inline] dm_ctl_ioctl+0xa9c/0xec0 drivers/md/dm-ioctl.c:2092 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff888077601780 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 24 bytes inside of 64-byte region [ffff888077601780, ffff8880776017c0) The buggy address belongs to the physical page: page:ffffea0001dd8040 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x77601 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888018441640 raw: 0000000000000000 0000000080200020 00000001ffffffff 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 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 6034, tgid 6034 (syz-executor), ts 368360204092, free_ts 368130796202 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2561 prep_new_page mm/page_alloc.c:2568 [inline] get_page_from_freelist+0x208b/0x21a0 mm/page_alloc.c:4368 __alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5668 alloc_slab_page+0x5d/0x180 mm/slub.c:1805 allocate_slab mm/slub.c:1950 [inline] new_slab+0x87/0x2d0 mm/slub.c:2003 ___slab_alloc+0xbc5/0x1240 mm/slub.c:3161 __slab_alloc mm/slub.c:3247 [inline] slab_alloc_node mm/slub.c:3332 [inline] __kmem_cache_alloc_node+0x126/0x270 mm/slub.c:3405 __do_kmalloc_node mm/slab_common.c:935 [inline] __kmalloc+0xa3/0x240 mm/slab_common.c:949 kmalloc include/linux/slab.h:568 [inline] kzalloc include/linux/slab.h:699 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x28a/0x550 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x578/0x5c0 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x26f/0x610 security/tomoyo/file.c:822 tomoyo_path_symlink+0xa8/0xf0 security/tomoyo/tomoyo.c:199 security_path_symlink+0xdc/0x130 security/security.c:1202 do_symlinkat+0x10c/0x400 fs/namei.c:4550 __do_sys_symlinkat fs/namei.c:4572 [inline] __se_sys_symlinkat fs/namei.c:4569 [inline] __x64_sys_symlinkat+0x95/0xa0 fs/namei.c:4569 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1488 [inline] free_pcp_prepare mm/page_alloc.c:1538 [inline] free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3422 free_unref_page_list+0xbb/0x8e0 mm/page_alloc.c:3563 release_pages+0x20d1/0x2340 mm/swap.c:1035 tlb_batch_pages_flush mm/mmu_gather.c:60 [inline] tlb_flush_mmu_free mm/mmu_gather.c:255 [inline] tlb_flush_mmu+0x105/0x220 mm/mmu_gather.c:262 tlb_finish_mmu+0xf0/0x220 mm/mmu_gather.c:394 exit_mmap+0x388/0x970 mm/mmap.c:3313 __mmput+0x118/0x3a0 kernel/fork.c:1204 exit_mm+0x24d/0x350 kernel/exit.c:572 do_exit+0x958/0x2570 kernel/exit.c:874 do_group_exit+0x229/0x2e0 kernel/exit.c:1030 get_signal+0x1348/0x1440 kernel/signal.c:2897 arch_do_signal_or_restart+0xc4/0x1310 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:177 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213 __syscall_exit_to_user_mode_work kernel/entry/common.c:295 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:306 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82 Memory state around the buggy address: ffff888077601680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888077601700: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff888077601780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff888077601800: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff888077601880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ==================================================================