==================================================================
BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:901 [inline]
BUG: KASAN: slab-use-after-free in detach_timer+0x14d/0x2f0 kernel/time/timer.c:880
Write of size 8 at addr ffff8880a8591500 by task kcompactd0/31
CPU: 1 PID: 31 Comm: kcompactd0 Not tainted 6.3.0-syzkaller-13091-g3c4aa4434377 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/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:351 [inline]
print_report+0x163/0x540 mm/kasan/report.c:462
kasan_report+0x176/0x1b0 mm/kasan/report.c:572
__hlist_del include/linux/list.h:901 [inline]
detach_timer+0x14d/0x2f0 kernel/time/timer.c:880
expire_timers kernel/time/timer.c:1734 [inline]
__run_timers+0x5d4/0x860 kernel/time/timer.c:2022
run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035
__do_softirq+0x2ab/0x908 kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x159/0x240 kernel/softirq.c:650
irq_exit_rcu+0x9/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1106
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194
Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 2e 99 2a f7 f6 44 24 21 02 75 4e 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 f3 46 a6 f6 65 8b 05 e4 ec 4a 75 85 c0 74 3f 48 c7 04 24 0e 36
RSP: 0018:ffffc90000a7f020 EFLAGS: 00000206
RAX: 17abe3f484799700 RBX: 1ffff9200014fe08 RCX: ffffffff816b930a
RDX: dffffc0000000000 RSI: ffffffff8aea8ea0 RDI: 0000000000000001
RBP: ffffc90000a7f0b0 R08: dffffc0000000000 R09: fffffbfff2065255
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 1ffff9200014fe04 R14: ffffc90000a7f040 R15: 0000000000000246
spin_unlock_irqrestore include/linux/spinlock.h:405 [inline]
unlock_page_lruvec_irqrestore include/linux/memcontrol.h:1645 [inline]
folio_lruvec_relock_irqsave include/linux/memcontrol.h:1678 [inline]
folio_batch_move_lru+0x304/0x6e0 mm/swap.c:216
lru_add_drain_cpu+0x10e/0x610 mm/swap.c:652
lru_add_drain+0x7d/0x140 mm/swap.c:752
migrate_folio_move mm/migrate.c:1293 [inline]
migrate_pages_batch+0x2631/0x3670 mm/migrate.c:1789
migrate_pages_sync mm/migrate.c:1867 [inline]
migrate_pages+0x214a/0x35d0 mm/migrate.c:1970
compact_zone+0x2ac4/0x4040 mm/compaction.c:2439
proactive_compact_node mm/compaction.c:2702 [inline]
kcompactd+0x1039/0x1ba0 mm/compaction.c:3003
kthread+0x2b8/0x350 kernel/kthread.c:379
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
Allocated by task 20605:
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
kasan_kmalloc include/linux/kasan.h:196 [inline]
__do_kmalloc_node mm/slab_common.c:966 [inline]
__kmalloc_node+0xb8/0x230 mm/slab_common.c:973
kmalloc_node include/linux/slab.h:579 [inline]
kvmalloc_node+0x72/0x180 mm/util.c:604
kvmalloc include/linux/slab.h:697 [inline]
kvzalloc include/linux/slab.h:705 [inline]
alloc_netdev_mqs+0x89/0xf30 net/core/dev.c:10626
rtnl_create_link+0x2f7/0xc00 net/core/rtnetlink.c:3315
rtnl_newlink_create net/core/rtnetlink.c:3433 [inline]
__rtnl_newlink net/core/rtnetlink.c:3660 [inline]
rtnl_newlink+0x1379/0x2010 net/core/rtnetlink.c:3673
rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6395
netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2546
netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365
netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1913
sock_sendmsg_nosec net/socket.c:724 [inline]
sock_sendmsg net/socket.c:747 [inline]
____sys_sendmsg+0x58f/0x890 net/socket.c:2503
___sys_sendmsg net/socket.c:2557 [inline]
__sys_sendmsg+0x2ad/0x390 net/socket.c:2586
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 27418:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:162 [inline]
slab_free_hook mm/slub.c:1781 [inline]
slab_free_freelist_hook mm/slub.c:1807 [inline]
slab_free mm/slub.c:3786 [inline]
__kmem_cache_free+0x264/0x3c0 mm/slub.c:3799
device_release+0x95/0x1c0
kobject_cleanup lib/kobject.c:683 [inline]
kobject_release lib/kobject.c:714 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x228/0x470 lib/kobject.c:731
netdev_run_todo+0xe5a/0xf50 net/core/dev.c:10400
default_device_exit_batch+0x5c9/0x630 net/core/dev.c:11392
ops_exit_list net/core/net_namespace.c:175 [inline]
cleanup_net+0x767/0xb80 net/core/net_namespace.c:614
process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405
worker_thread+0xa63/0x1210 kernel/workqueue.c:2552
kthread+0x2b8/0x350 kernel/kthread.c:379
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
Last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491
insert_work+0x54/0x3d0 kernel/workqueue.c:1365
__queue_work+0xb37/0xf10 kernel/workqueue.c:1526
call_timer_fn+0x178/0x580 kernel/time/timer.c:1700
expire_timers kernel/time/timer.c:1746 [inline]
__run_timers+0x67a/0x860 kernel/time/timer.c:2022
run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035
__do_softirq+0x2ab/0x908 kernel/softirq.c:571
Second to last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491
insert_work+0x54/0x3d0 kernel/workqueue.c:1365
__queue_work+0xb37/0xf10 kernel/workqueue.c:1526
call_timer_fn+0x178/0x580 kernel/time/timer.c:1700
expire_timers kernel/time/timer.c:1746 [inline]
__run_timers+0x67a/0x860 kernel/time/timer.c:2022
run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035
__do_softirq+0x2ab/0x908 kernel/softirq.c:571
The buggy address belongs to the object at ffff8880a8590000
which belongs to the cache kmalloc-cg-8k of size 8192
The buggy address is located 5376 bytes inside of
freed 8192-byte region [ffff8880a8590000, ffff8880a8592000)
The buggy address belongs to the physical page:
page:ffffea0002a16400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xa8590
head:ffffea0002a16400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff888078d96141
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff88801244f640 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000020002 00000001ffffffff ffff888078d96141
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 20605, tgid 20603 (syz-executor.5), ts 809035526752, free_ts 808946284319
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731
prep_new_page mm/page_alloc.c:1738 [inline]
get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502
__alloc_pages+0x255/0x670 mm/page_alloc.c:4768
alloc_slab_page+0x6a/0x160 mm/slub.c:1851
allocate_slab mm/slub.c:1998 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2051
___slab_alloc+0xa85/0x10a0 mm/slub.c:3192
__slab_alloc mm/slub.c:3291 [inline]
__slab_alloc_node mm/slub.c:3344 [inline]
slab_alloc_node mm/slub.c:3441 [inline]
__kmem_cache_alloc_node+0x1b8/0x290 mm/slub.c:3490
__do_kmalloc_node mm/slab_common.c:965 [inline]
__kmalloc_node+0xa7/0x230 mm/slab_common.c:973
kmalloc_node include/linux/slab.h:579 [inline]
kvmalloc_node+0x72/0x180 mm/util.c:604
kvmalloc include/linux/slab.h:697 [inline]
kvzalloc include/linux/slab.h:705 [inline]
alloc_netdev_mqs+0x89/0xf30 net/core/dev.c:10626
rtnl_create_link+0x2f7/0xc00 net/core/rtnetlink.c:3315
rtnl_newlink_create net/core/rtnetlink.c:3433 [inline]
__rtnl_newlink net/core/rtnetlink.c:3660 [inline]
rtnl_newlink+0x1379/0x2010 net/core/rtnetlink.c:3673
rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6395
netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2546
netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365
netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1913
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1302 [inline]
free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2659
qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711
slab_alloc_node mm/slub.c:3451 [inline]
kmem_cache_alloc_node+0x157/0x350 mm/slub.c:3496
__alloc_skb+0x181/0x420 net/core/skbuff.c:644
alloc_skb include/linux/skbuff.h:1288 [inline]
netlink_alloc_large_skb net/netlink/af_netlink.c:1211 [inline]
netlink_sendmsg+0x6fc/0xd60 net/netlink/af_netlink.c:1888
sock_sendmsg_nosec net/socket.c:724 [inline]
sock_sendmsg net/socket.c:747 [inline]
____sys_sendmsg+0x58f/0x890 net/socket.c:2503
___sys_sendmsg net/socket.c:2557 [inline]
__sys_sendmsg+0x2ad/0x390 net/socket.c:2586
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Memory state around the buggy address:
ffff8880a8591400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a8591480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a8591500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a8591580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a8591600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 9c pushfq
1: 8f 44 24 20 popq 0x20(%rsp)
5: 42 80 3c 23 00 cmpb $0x0,(%rbx,%r12,1)
a: 74 08 je 0x14
c: 4c 89 f7 mov %r14,%rdi
f: e8 2e 99 2a f7 callq 0xf72a9942
14: f6 44 24 21 02 testb $0x2,0x21(%rsp)
19: 75 4e jne 0x69
1b: 41 f7 c7 00 02 00 00 test $0x200,%r15d
22: 74 01 je 0x25
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 f3 46 a6 f6 callq 0xf6a64722 <-- trapping instruction
2f: 65 8b 05 e4 ec 4a 75 mov %gs:0x754aece4(%rip),%eax # 0x754aed1a
36: 85 c0 test %eax,%eax
38: 74 3f je 0x79
3a: 48 rex.W
3b: c7 .byte 0xc7
3c: 04 24 add $0x24,%al
3e: 0e (bad)
3f: 36 ss