==================================================================
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:814 [inline]
BUG: KASAN: use-after-free in enqueue_timer+0x9e/0x2c0 kernel/time/timer.c:541
Write of size 8 at addr ffff8881e884f1c8 by task syz.2.68/618
CPU: 1 PID: 618 Comm: syz.2.68 Not tainted 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
__dump_stack+0x1e/0x20 lib/dump_stack.c:77
dump_stack+0x15b/0x1b8 lib/dump_stack.c:118
print_address_description+0x8d/0x4c0 mm/kasan/report.c:384
__kasan_report+0xef/0x120 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
__asan_report_store8_noabort+0x17/0x20 mm/kasan/generic_report.c:137
hlist_add_head include/linux/list.h:814 [inline]
enqueue_timer+0x9e/0x2c0 kernel/time/timer.c:541
__internal_add_timer kernel/time/timer.c:554 [inline]
internal_add_timer+0x208/0x3e0 kernel/time/timer.c:604
__mod_timer+0x5ab/0x1150 kernel/time/timer.c:1065
mod_timer+0x1f/0x30 kernel/time/timer.c:1117
can_stat_update+0xbab/0xc40 net/can/proc.c:186
call_timer_fn+0x3c/0x380 kernel/time/timer.c:1448
expire_timers kernel/time/timer.c:1493 [inline]
__run_timers+0x81d/0xb60 kernel/time/timer.c:1817
run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1830
__do_softirq+0x236/0x660 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:373 [inline]
irq_exit+0x197/0x1c0 kernel/softirq.c:413
exiting_irq arch/x86/include/asm/apic.h:539 [inline]
smp_apic_timer_interrupt+0x11d/0x490 arch/x86/kernel/apic/apic.c:1161
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:834
RIP: 0010:__read_once_size include/linux/compiler.h:268 [inline]
RIP: 0010:unwind_next_frame+0x3e8/0x760 arch/x86/kernel/unwind_frame.c:307
Code: 74 12 48 8d 75 c8 4c 89 ff e8 94 03 00 00 48 8b 75 c8 eb 19 4c 89 f8 48 c1 e8 03 42 80 3c 00 00 74 08 4c 89 ff e8 88 d9 5f 00 <49> 8b 37 48 89 df 48 89 75 c0 e8 79 03 00 00 89 c1 b0 01 84 c9 0f
RSP: 0018:ffff8881e4fdf258 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: 1ffff1103c9fbebe RBX: ffff8881e4fdf2e8 RCX: 0000000000000000
RDX: ffff8881e48f4ec0 RSI: 0000000000000000 RDI: ffff8881e4fdff48
RBP: ffff8881e4fdf2d8 R08: dffffc0000000000 R09: ffff8881e4fdf2e8
R10: ffffed103c9fbe69 R11: 1ffff1103c9fbe5d R12: 0000000000000000
R13: 1ffff1103c9fbe68 R14: ffff8881e4fdf340 R15: ffff8881e4fdf5f0
arch_stack_walk+0x10c/0x140 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0xaa/0xf0 kernel/stacktrace.c:123
save_stack+0x97/0x560 mm/page_owner.c:122
__reset_page_owner+0x23/0x110 mm/page_owner.c:149
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1176 [inline]
free_pcp_prepare mm/page_alloc.c:1233 [inline]
free_unref_page_prepare+0x2a9/0x3a0 mm/page_alloc.c:3085
free_unref_page_list+0x110/0x4c0 mm/page_alloc.c:3154
release_pages+0xa62/0xaa0 mm/swap.c:842
free_pages_and_swap_cache+0x86/0xa0 mm/swap_state.c:297
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:189 [inline]
tlb_flush_mmu mm/mmu_gather.c:196 [inline]
tlb_finish_mmu+0x175/0x300 mm/mmu_gather.c:277
exit_mmap+0x2db/0x520 mm/mmap.c:3193
__mmput+0x92/0x2e0 kernel/fork.c:1101
mmput+0x47/0x60 kernel/fork.c:1122
exit_mm kernel/exit.c:538 [inline]
do_exit+0x99f/0x2660 kernel/exit.c:848
do_group_exit+0x13e/0x300 kernel/exit.c:984
get_signal+0xdee/0x13d0 kernel/signal.c:2738
do_signal+0xad/0xda0 arch/x86/kernel/signal.c:809
exit_to_usermode_loop+0xc4/0x1b0 arch/x86/entry/common.c:159
prepare_exit_to_usermode+0x18e/0x1f0 arch/x86/entry/common.c:194
syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
do_syscall_64+0x13e/0x170 arch/x86/entry/common.c:300
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
RIP: 0033:0x7fc93285f969
Code: Bad RIP value.
RSP: 002b:00007fc930ec8038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffea RBX: 00007fc932a86fa0 RCX: 00007fc93285f969
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000012
RBP: 00007fc9328e1ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fc932a86fa0 R15: 00007ffc573757e8
Allocated by task 342:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x162/0x200 mm/kasan/common.c:529
kasan_slab_alloc+0x12/0x20 mm/kasan/common.c:537
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2829 [inline]
slab_alloc mm/slub.c:2837 [inline]
kmem_cache_alloc+0xe2/0x270 mm/slub.c:2842
getname_flags+0xb9/0x500 fs/namei.c:141
getname fs/namei.c:212 [inline]
do_rmdir+0xcb/0x480 fs/namei.c:4055
__do_sys_unlinkat fs/namei.c:4252 [inline]
__se_sys_unlinkat fs/namei.c:4246 [inline]
__x64_sys_unlinkat+0xb6/0xe0 fs/namei.c:4246
do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
Freed by task 342:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
kasan_set_free_info mm/kasan/common.c:345 [inline]
__kasan_slab_free+0x1c3/0x280 mm/kasan/common.c:487
kasan_slab_free+0xe/0x10 mm/kasan/common.c:496
slab_free_hook mm/slub.c:1455 [inline]
slab_free_freelist_hook+0xb7/0x180 mm/slub.c:1494
slab_free mm/slub.c:3080 [inline]
kmem_cache_free+0x10c/0x2c0 mm/slub.c:3096
putname fs/namei.c:262 [inline]
do_rmdir+0x392/0x480 fs/namei.c:4096
__do_sys_unlinkat fs/namei.c:4252 [inline]
__se_sys_unlinkat fs/namei.c:4246 [inline]
__x64_sys_unlinkat+0xb6/0xe0 fs/namei.c:4246
do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
The buggy address belongs to the object at ffff8881e884e600
which belongs to the cache names_cache of size 4096
The buggy address is located 3016 bytes inside of
4096-byte region [ffff8881e884e600, ffff8881e884f600)
The buggy address belongs to the page:
page:ffffea0007a21200 refcount:1 mapcount:0 mapping:ffff8881f5d01900 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5d01900
raw: 0000000000000000 0000000000070007 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)
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook mm/page_alloc.c:2165 [inline]
prep_new_page+0x35e/0x370 mm/page_alloc.c:2171
get_page_from_freelist+0x1296/0x1310 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x202/0x4b0 mm/page_alloc.c:4894
alloc_slab_page+0x3c/0x3b0 mm/slub.c:343
allocate_slab mm/slub.c:1683 [inline]
new_slab+0x93/0x420 mm/slub.c:1749
new_slab_objects mm/slub.c:2505 [inline]
___slab_alloc+0x29e/0x420 mm/slub.c:2667
__slab_alloc+0x63/0xa0 mm/slub.c:2707
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2837 [inline]
kmem_cache_alloc+0x12c/0x270 mm/slub.c:2842
getname_flags+0xb9/0x500 fs/namei.c:141
getname fs/namei.c:212 [inline]
__do_sys_unlink fs/namei.c:4259 [inline]
__se_sys_unlink fs/namei.c:4257 [inline]
__x64_sys_unlink+0x3c/0x50 fs/namei.c:4257
do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1176 [inline]
free_pcp_prepare mm/page_alloc.c:1233 [inline]
free_unref_page_prepare+0x2a9/0x3a0 mm/page_alloc.c:3085
free_unref_page mm/page_alloc.c:3134 [inline]
free_the_page mm/page_alloc.c:4954 [inline]
__free_pages+0xaa/0x110 mm/page_alloc.c:4962
pcpu_free_pages mm/percpu-vm.c:64 [inline]
pcpu_depopulate_chunk mm/percpu-vm.c:328 [inline]
pcpu_balance_workfn+0x8c7/0x14b0 mm/percpu.c:1865
process_one_work+0x73b/0xcc0 kernel/workqueue.c:2290
worker_thread+0xa5c/0x13b0 kernel/workqueue.c:2436
kthread+0x31e/0x3a0 kernel/kthread.c:288
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354
Memory state around the buggy address:
ffff8881e884f080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881e884f100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881e884f180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881e884f200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881e884f280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
PGD 1cb935067 P4D 1cb935067 PUD 0
Oops: 0010 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 618 Comm: syz.2.68 Tainted: G B 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
RIP: 0010:0x0
Code: Bad RIP value.
RSP: 0018:ffff8881f6f09cf0 EFLAGS: 00010206
RAX: ffffffff8150a590 RBX: 0000000000000100 RCX: ffff8881e48f4ec0
RDX: 0000000000000100 RSI: 0000000000000000 RDI: ffff8881e884f1c0
RBP: ffff8881f6f09d30 R08: 0000000000000004 R09: 0000000000000003
R10: ffffed103ede1398 R11: 1ffff1103ede1398 R12: 00000000ffff9880
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff8881e884f1c0
FS: 00007fc930ec86c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 00000001e7f00000 CR4: 00000000003406a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
call_timer_fn+0x3c/0x380 kernel/time/timer.c:1448
expire_timers kernel/time/timer.c:1493 [inline]
__run_timers+0x81d/0xb60 kernel/time/timer.c:1817
run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1830
__do_softirq+0x236/0x660 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:373 [inline]
irq_exit+0x197/0x1c0 kernel/softirq.c:413
exiting_irq arch/x86/include/asm/apic.h:539 [inline]
smp_apic_timer_interrupt+0x11d/0x490 arch/x86/kernel/apic/apic.c:1161
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:834
RIP: 0010:__read_once_size include/linux/compiler.h:268 [inline]
RIP: 0010:unwind_next_frame+0x3e8/0x760 arch/x86/kernel/unwind_frame.c:307
Code: 74 12 48 8d 75 c8 4c 89 ff e8 94 03 00 00 48 8b 75 c8 eb 19 4c 89 f8 48 c1 e8 03 42 80 3c 00 00 74 08 4c 89 ff e8 88 d9 5f 00 <49> 8b 37 48 89 df 48 89 75 c0 e8 79 03 00 00 89 c1 b0 01 84 c9 0f
RSP: 0018:ffff8881e4fdf258 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: 1ffff1103c9fbebe RBX: ffff8881e4fdf2e8 RCX: 0000000000000000
RDX: ffff8881e48f4ec0 RSI: 0000000000000000 RDI: ffff8881e4fdff48
RBP: ffff8881e4fdf2d8 R08: dffffc0000000000 R09: ffff8881e4fdf2e8
R10: ffffed103c9fbe69 R11: 1ffff1103c9fbe5d R12: 0000000000000000
R13: 1ffff1103c9fbe68 R14: ffff8881e4fdf340 R15: ffff8881e4fdf5f0
arch_stack_walk+0x10c/0x140 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0xaa/0xf0 kernel/stacktrace.c:123
save_stack+0x97/0x560 mm/page_owner.c:122
__reset_page_owner+0x23/0x110 mm/page_owner.c:149
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1176 [inline]
free_pcp_prepare mm/page_alloc.c:1233 [inline]
free_unref_page_prepare+0x2a9/0x3a0 mm/page_alloc.c:3085
free_unref_page_list+0x110/0x4c0 mm/page_alloc.c:3154
release_pages+0xa62/0xaa0 mm/swap.c:842
free_pages_and_swap_cache+0x86/0xa0 mm/swap_state.c:297
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:189 [inline]
tlb_flush_mmu mm/mmu_gather.c:196 [inline]
tlb_finish_mmu+0x175/0x300 mm/mmu_gather.c:277
exit_mmap+0x2db/0x520 mm/mmap.c:3193
__mmput+0x92/0x2e0 kernel/fork.c:1101
mmput+0x47/0x60 kernel/fork.c:1122
exit_mm kernel/exit.c:538 [inline]
do_exit+0x99f/0x2660 kernel/exit.c:848
do_group_exit+0x13e/0x300 kernel/exit.c:984
get_signal+0xdee/0x13d0 kernel/signal.c:2738
do_signal+0xad/0xda0 arch/x86/kernel/signal.c:809
exit_to_usermode_loop+0xc4/0x1b0 arch/x86/entry/common.c:159
prepare_exit_to_usermode+0x18e/0x1f0 arch/x86/entry/common.c:194
syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
do_syscall_64+0x13e/0x170 arch/x86/entry/common.c:300
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
RIP: 0033:0x7fc93285f969
Code: Bad RIP value.
RSP: 002b:00007fc930ec8038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffea RBX: 00007fc932a86fa0 RCX: 00007fc93285f969
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000012
RBP: 00007fc9328e1ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fc932a86fa0 R15: 00007ffc573757e8
Modules linked in:
CR2: 0000000000000000
---[ end trace 2870a45af2db28a7 ]---
RIP: 0010:0x0
Code: Bad RIP value.
RSP: 0018:ffff8881f6f09cf0 EFLAGS: 00010206
RAX: ffffffff8150a590 RBX: 0000000000000100 RCX: ffff8881e48f4ec0
RDX: 0000000000000100 RSI: 0000000000000000 RDI: ffff8881e884f1c0
RBP: ffff8881f6f09d30 R08: 0000000000000004 R09: 0000000000000003
R10: ffffed103ede1398 R11: 1ffff1103ede1398 R12: 00000000ffff9880
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff8881e884f1c0
FS: 00007fc930ec86c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 00000001e7f00000 CR4: 00000000003406a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 74 12 je 0x14
2: 48 8d 75 c8 lea -0x38(%rbp),%rsi
6: 4c 89 ff mov %r15,%rdi
9: e8 94 03 00 00 call 0x3a2
e: 48 8b 75 c8 mov -0x38(%rbp),%rsi
12: eb 19 jmp 0x2d
14: 4c 89 f8 mov %r15,%rax
17: 48 c1 e8 03 shr $0x3,%rax
1b: 42 80 3c 00 00 cmpb $0x0,(%rax,%r8,1)
20: 74 08 je 0x2a
22: 4c 89 ff mov %r15,%rdi
25: e8 88 d9 5f 00 call 0x5fd9b2
* 2a: 49 8b 37 mov (%r15),%rsi <-- trapping instruction
2d: 48 89 df mov %rbx,%rdi
30: 48 89 75 c0 mov %rsi,-0x40(%rbp)
34: e8 79 03 00 00 call 0x3b2
39: 89 c1 mov %eax,%ecx
3b: b0 01 mov $0x1,%al
3d: 84 c9 test %cl,%cl
3f: 0f .byte 0xf