================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x11c/0x7f70 kernel/locking/lockdep.c:5004 Read of size 8 at addr ffff8880802e5020 by task syz-executor.1/10766 CPU: 0 PID: 10766 Comm: syz-executor.1 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x163/0x540 mm/kasan/report.c:475 kasan_report+0x142/0x170 mm/kasan/report.c:588 __lock_acquire+0x11c/0x7f70 kernel/locking/lockdep.c:5004 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5753 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 ptp_release+0x96/0x1e0 drivers/ptp/ptp_chardev.c:146 ptp_read+0x17f/0x820 drivers/ptp/ptp_chardev.c:589 posix_clock_read+0x12f/0x190 kernel/time/posix-clock.c:51 do_loop_readv_writev fs/read_write.c:755 [inline] do_iter_read+0x572/0xd90 fs/read_write.c:797 vfs_readv fs/read_write.c:915 [inline] do_preadv+0x212/0x350 fs/read_write.c:1007 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7ff44707cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff447e560c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00007ff44719bf80 RCX: 00007ff44707cae9 RDX: 0000000000000007 RSI: 00000000200023c0 RDI: 0000000000000004 RBP: 00007ff4470c847a R08: 000000000000af73 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff44719bf80 R15: 00007ffc72577198 Allocated by task 10766: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] ptp_open+0xd9/0x430 drivers/ptp/ptp_chardev.c:112 posix_clock_open+0x155/0x1f0 kernel/time/posix-clock.c:134 chrdev_open+0x5ab/0x630 fs/char_dev.c:414 do_dentry_open+0x8fd/0x1590 fs/open.c:948 do_open fs/namei.c:3622 [inline] path_openat+0x2845/0x3280 fs/namei.c:3779 do_filp_open+0x234/0x490 fs/namei.c:3809 do_sys_openat2+0x13e/0x1d0 fs/open.c:1440 do_sys_open fs/open.c:1455 [inline] __do_sys_openat fs/open.c:1471 [inline] __se_sys_openat fs/open.c:1466 [inline] __x64_sys_openat+0x247/0x290 fs/open.c:1466 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b Freed by task 10775: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook mm/slub.c:1826 [inline] slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0x263/0x3a0 mm/slub.c:3822 ptp_release+0x1ce/0x1e0 drivers/ptp/ptp_chardev.c:150 ptp_read+0x17f/0x820 drivers/ptp/ptp_chardev.c:589 posix_clock_read+0x12f/0x190 kernel/time/posix-clock.c:51 do_loop_readv_writev fs/read_write.c:755 [inline] do_iter_read+0x572/0xd90 fs/read_write.c:797 vfs_readv fs/read_write.c:915 [inline] do_preadv+0x212/0x350 fs/read_write.c:1007 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b The buggy address belongs to the object at ffff8880802e4000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 4128 bytes inside of freed 8192-byte region [ffff8880802e4000, ffff8880802e6000) The buggy address belongs to the physical page: page:ffffea000200b800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x802e0 head:ffffea000200b800 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888012c42280 ffffea0002037c00 0000000000000005 raw: 0000000000000000 0000000080020002 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 10465, tgid 10459 (syz-executor.5), ts 2355471164267, free_ts 2355178402471 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1544 [inline] get_page_from_freelist+0x339a/0x3530 mm/page_alloc.c:3312 __alloc_pages+0x255/0x670 mm/page_alloc.c:4568 alloc_pages_mpol+0x3de/0x640 mm/mempolicy.c:2133 alloc_slab_page+0x6a/0x160 mm/slub.c:1870 allocate_slab mm/slub.c:2017 [inline] new_slab+0x84/0x2f0 mm/slub.c:2070 ___slab_alloc+0xc85/0x1310 mm/slub.c:3223 __slab_alloc mm/slub.c:3322 [inline] __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x21d/0x300 mm/slub.c:3517 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1098 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] ptp_open+0xd9/0x430 drivers/ptp/ptp_chardev.c:112 posix_clock_open+0x155/0x1f0 kernel/time/posix-clock.c:134 chrdev_open+0x5ab/0x630 fs/char_dev.c:414 do_dentry_open+0x8fd/0x1590 fs/open.c:948 do_open fs/namei.c:3622 [inline] path_openat+0x2845/0x3280 fs/namei.c:3779 do_filp_open+0x234/0x490 fs/namei.c:3809 do_sys_openat2+0x13e/0x1d0 fs/open.c:1440 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1137 [inline] free_unref_page_prepare+0x92a/0xa50 mm/page_alloc.c:2347 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2487 discard_slab mm/slub.c:2116 [inline] __unfreeze_partials+0x1dc/0x220 mm/slub.c:2655 put_cpu_partial+0x17b/0x250 mm/slub.c:2731 __slab_free+0x2b6/0x390 mm/slub.c:3679 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x75/0xe0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook+0x6c/0x3c0 mm/slab.h:763 slab_alloc_node mm/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x1be/0x350 mm/slub.c:3502 anon_vma_chain_alloc mm/rmap.c:142 [inline] __anon_vma_prepare+0x68/0x410 mm/rmap.c:196 anon_vma_prepare include/linux/rmap.h:159 [inline] do_anonymous_page mm/memory.c:4169 [inline] do_pte_missing mm/memory.c:3728 [inline] handle_pte_fault mm/memory.c:5038 [inline] __handle_mm_fault mm/memory.c:5179 [inline] handle_mm_fault+0x5468/0x6650 mm/memory.c:5344 do_user_addr_fault arch/x86/mm/fault.c:1413 [inline] handle_page_fault arch/x86/mm/fault.c:1505 [inline] exc_page_fault+0x2ac/0x860 arch/x86/mm/fault.c:1561 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 Memory state around the buggy address: ffff8880802e4f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880802e4f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880802e5000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880802e5080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880802e5100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================