================================================================== BUG: KASAN: slab-use-after-free in __list_del_entry_valid_or_report+0x198/0x1b0 lib/list_debug.c:62 Read of size 8 at addr ffff88807e991048 by task syz-executor712/7919 CPU: 1 PID: 7919 Comm: syz-executor712 Not tainted 6.6.0-syzkaller-15156-g13d88ac54ddd #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+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 __list_del_entry_valid_or_report+0x198/0x1b0 lib/list_debug.c:62 __list_del_entry_valid include/linux/list.h:124 [inline] __list_del_entry include/linux/list.h:215 [inline] list_del include/linux/list.h:229 [inline] ptp_release+0xc4/0x2b0 drivers/ptp/ptp_chardev.c:147 posix_clock_release+0xa4/0x160 kernel/time/posix-clock.c:157 __fput+0x270/0xbb0 fs/file_table.c:394 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa92/0x2ae0 kernel/exit.c:871 do_group_exit+0xd4/0x2a0 kernel/exit.c:1021 __do_sys_exit_group kernel/exit.c:1032 [inline] __se_sys_exit_group kernel/exit.c:1030 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1030 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f47df1a6bf9 Code: Unable to access opcode bytes at 0x7f47df1a6bcf. RSP: 002b:00007ffc1663af48 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f47df1a6bf9 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 00007f47df221290 R08: ffffffffffffffb8 R09: 00000000000000a0 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f47df221290 R13: 0000000000000000 R14: 00007f47df221d00 R15: 00007f47df177da0 Allocated by task 7920: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] ptp_open+0xe3/0x4f0 drivers/ptp/ptp_chardev.c:112 posix_clock_open+0x17e/0x240 kernel/time/posix-clock.c:134 chrdev_open+0x26d/0x6e0 fs/char_dev.c:414 do_dentry_open+0x8d4/0x18d0 fs/open.c:948 do_open fs/namei.c:3622 [inline] path_openat+0x1d4e/0x2c40 fs/namei.c:3779 do_filp_open+0x1de/0x430 fs/namei.c:3809 do_sys_openat2+0x176/0x1e0 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+0x175/0x210 fs/open.c:1466 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b Freed by task 7920: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xc0/0x180 mm/slub.c:3822 ptp_release+0x204/0x2b0 drivers/ptp/ptp_chardev.c:150 posix_clock_release+0xa4/0x160 kernel/time/posix-clock.c:157 __fput+0x270/0xbb0 fs/file_table.c:394 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa92/0x2ae0 kernel/exit.c:871 do_group_exit+0xd4/0x2a0 kernel/exit.c:1021 __do_sys_exit_group kernel/exit.c:1032 [inline] __se_sys_exit_group kernel/exit.c:1030 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1030 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b The buggy address belongs to the object at ffff88807e990000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 4168 bytes inside of freed 8192-byte region [ffff88807e990000, ffff88807e992000) The buggy address belongs to the physical page: page:ffffea0001fa6400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7e990 head:ffffea0001fa6400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 ksm flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888013042280 ffffea0001fa7e00 dead000000000003 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4743, tgid 4743 (dhcpcd-run-hook), ts 42629328203, free_ts 42616373634 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1544 [inline] get_page_from_freelist+0xa25/0x36c0 mm/page_alloc.c:3312 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4568 alloc_pages_mpol+0x258/0x5f0 mm/mempolicy.c:2133 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x131/0x310 mm/slub.c:3517 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1098 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] tomoyo_print_bprm security/tomoyo/audit.c:26 [inline] tomoyo_init_log+0xcdf/0x2110 security/tomoyo/audit.c:264 tomoyo_supervisor+0x30c/0xea0 security/tomoyo/common.c:2089 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x18f/0x200 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0xef6/0x2020 security/tomoyo/domain.c:878 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:101 [inline] tomoyo_bprm_check_security+0x12b/0x1d0 security/tomoyo/tomoyo.c:91 security_bprm_check+0x6a/0xe0 security/security.c:1103 search_binary_handler fs/exec.c:1725 [inline] exec_binprm fs/exec.c:1779 [inline] bprm_execve fs/exec.c:1854 [inline] bprm_execve+0x73a/0x1a90 fs/exec.c:1810 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+0x4f8/0xa90 mm/page_alloc.c:2347 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487 __unfreeze_partials+0x21d/0x240 mm/slub.c:2655 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:763 [inline] slab_alloc_node mm/slub.c:3478 [inline] __kmem_cache_alloc_node+0x195/0x310 mm/slub.c:3517 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1098 kmalloc include/linux/slab.h:600 [inline] tomoyo_print_header security/tomoyo/audit.c:156 [inline] tomoyo_init_log+0x1a0/0x2110 security/tomoyo/audit.c:255 tomoyo_supervisor+0x30c/0xea0 security/tomoyo/common.c:2089 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x270/0x3b0 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x371/0x3b0 security/tomoyo/file.c:777 tomoyo_file_open security/tomoyo/tomoyo.c:332 [inline] tomoyo_file_open+0xa8/0xd0 security/tomoyo/tomoyo.c:327 security_file_open+0x6a/0xe0 security/security.c:2836 do_dentry_open+0x583/0x18d0 fs/open.c:935 do_open fs/namei.c:3622 [inline] path_openat+0x1d4e/0x2c40 fs/namei.c:3779 Memory state around the buggy address: ffff88807e990f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807e990f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807e991000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807e991080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807e991100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== list_del corruption. prev->next should be ffff88801c725048, but was dead000000000100. (prev=ffff88807e991048) ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:62! invalid opcode: 0000 [#2] PREEMPT SMP KASAN CPU: 1 PID: 7919 Comm: syz-executor712 Tainted: G B D 6.6.0-syzkaller-15156-g13d88ac54ddd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 RIP: 0010:__list_del_entry_valid_or_report+0x11f/0x1b0 lib/list_debug.c:62 Code: ee 2e 8b e8 23 3a 02 fd 0f 0b 48 89 ca 48 c7 c7 40 ef 2e 8b e8 12 3a 02 fd 0f 0b 48 89 c2 48 c7 c7 a0 ef 2e 8b e8 01 3a 02 fd <0f> 0b 48 89 d1 48 c7 c7 20 f0 2e 8b 48 89 c2 e8 ed 39 02 fd 0f 0b RSP: 0018:ffffc9000b30fc78 EFLAGS: 00010082 RAX: 000000000000006d RBX: ffff88801c724000 RCX: ffffffff816b6ea9 RDX: 0000000000000000 RSI: ffffffff816c0332 RDI: 0000000000000005 RBP: ffff88807bf93d60 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000001 R11: 6f6974707572726f R12: 0000000000000246 R13: ffff88801c725048 R14: ffff88801c725008 R15: ffff88801c725050 FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc1663aea8 CR3: 000000000cd77000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __list_del_entry_valid include/linux/list.h:124 [inline] __list_del_entry include/linux/list.h:215 [inline] list_del include/linux/list.h:229 [inline] ptp_release+0xc4/0x2b0 drivers/ptp/ptp_chardev.c:147 posix_clock_release+0xa4/0x160 kernel/time/posix-clock.c:157 __fput+0x270/0xbb0 fs/file_table.c:394 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa92/0x2ae0 kernel/exit.c:871 do_group_exit+0xd4/0x2a0 kernel/exit.c:1021 __do_sys_exit_group kernel/exit.c:1032 [inline] __se_sys_exit_group kernel/exit.c:1030 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1030 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f47df1a6bf9 Code: Unable to access opcode bytes at 0x7f47df1a6bcf. RSP: 002b:00007ffc1663af48 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f47df1a6bf9 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 00007f47df221290 R08: ffffffffffffffb8 R09: 00000000000000a0 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f47df221290 R13: 0000000000000000 R14: 00007f47df221d00 R15: 00007f47df177da0 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__list_del_entry_valid_or_report+0x133/0x1b0 lib/list_debug.c:65 Code: e8 12 3a 02 fd 0f 0b 48 89 c2 48 c7 c7 a0 ef 2e 8b e8 01 3a 02 fd 0f 0b 48 89 d1 48 c7 c7 20 f0 2e 8b 48 89 c2 e8 ed 39 02 fd <0f> 0b 48 89 34 24 e8 b2 67 76 fd 48 8b 34 24 e9 e3 fe ff ff 48 89 RSP: 0018:ffffc9000b25fc78 EFLAGS: 00010082 RAX: 000000000000006d RBX: ffff88807e994000 RCX: ffffffff816b6ea9 RDX: 0000000000000000 RSI: ffffffff816c0332 RDI: 0000000000000005 RBP: ffff888028129180 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000001 R11: 0000000000000049 R12: 0000000000000246 R13: ffff88807e995048 R14: ffff88807e995008 R15: ffff88807e995050 FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc1663aea8 CR3: 000000000cd77000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400