================================================================== BUG: KASAN: use-after-free in pool_ctr+0x86a/0xd50 drivers/md/dm-thin.c:3344 Read of size 8 at addr ffff888058c5e218 by task syz.1.535/6217 CPU: 0 PID: 6217 Comm: syz.1.535 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:0x7fc6df3a9b59 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:00007fc6e01a8028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fc6df635fa0 RCX: 00007fc6df3a9b59 RDX: 0000200000000d40 RSI: 00000000c138fd09 RDI: 0000000000000003 RBP: 00007fc6df43a18b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fc6df636038 R14: 00007fc6df635fa0 R15: 00007ffdc13d6868 Allocated by task 6217: 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 6217: 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 ffff888058c5e200 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 24 bytes inside of 64-byte region [ffff888058c5e200, ffff888058c5e240) The buggy address belongs to the physical page: page:ffffea0001631780 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x58c5e flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000c1ce40 dead000000000004 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 4274, tgid 4274 (syz-executor), ts 178966115815, free_ts 178605337213 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_unlink+0xa7/0xf0 security/tomoyo/tomoyo.c:149 security_path_unlink+0xd8/0x130 security/security.c:1193 do_unlinkat+0x2af/0x580 fs/namei.c:4441 __do_sys_unlink fs/namei.c:4493 [inline] __se_sys_unlink fs/namei.c:4491 [inline] __x64_sys_unlink+0x45/0x50 fs/namei.c:4491 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+0x2e/0x3f0 mm/page_alloc.c:3517 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:306 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x4b/0x490 mm/slab.h:742 slab_alloc_node mm/slub.c:3366 [inline] slab_alloc mm/slub.c:3374 [inline] __kmem_cache_alloc_lru mm/slub.c:3381 [inline] kmem_cache_alloc+0x18b/0x2f0 mm/slub.c:3390 getname_flags+0xb7/0x500 fs/namei.c:139 getname fs/namei.c:218 [inline] __do_sys_unlink fs/namei.c:4493 [inline] __se_sys_unlink fs/namei.c:4491 [inline] __x64_sys_unlink+0x38/0x50 fs/namei.c:4491 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 Memory state around the buggy address: ffff888058c5e100: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ffff888058c5e180: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff888058c5e200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff888058c5e280: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff888058c5e300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ================================================================== 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 4274, tgid 4274 (syz-executor), ts 178966115815, free_ts 178605337213