==================================================================
BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:982 [inline]
BUG: KASAN: slab-use-after-free in hlist_del_rcu include/linux/rculist.h:560 [inline]
BUG: KASAN: slab-use-after-free in __xfrm_state_delete+0x9e5/0xa30 net/xfrm/xfrm_state.c:830
Write of size 8 at addr ffff888051840470 by task syz-executor/6006
CPU: 0 UID: 0 PID: 6006 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xcd/0x630 mm/kasan/report.c:482
kasan_report+0xe0/0x110 mm/kasan/report.c:595
__hlist_del include/linux/list.h:982 [inline]
hlist_del_rcu include/linux/rculist.h:560 [inline]
__xfrm_state_delete+0x9e5/0xa30 net/xfrm/xfrm_state.c:830
xfrm_timer_handler+0x86c/0xf10 net/xfrm/xfrm_state.c:716
__run_hrtimer kernel/time/hrtimer.c:1761 [inline]
__hrtimer_run_queues+0x1ff/0xad0 kernel/time/hrtimer.c:1825
hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1842
handle_softirqs+0x216/0x8e0 kernel/softirq.c:579
__do_softirq kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0x109/0x170 kernel/softirq.c:680
irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline]
sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1050
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:__sanitizer_cov_trace_pc+0x41/0x70 kernel/kcov.c:217
Code: a9 00 01 ff 00 74 1d f6 c4 01 74 43 a9 00 00 0f 00 75 3c a9 00 00 f0 00 75 35 8b 82 3c 16 00 00 85 c0 74 2b 8b 82 18 16 00 00 <83> f8 02 75 20 48 8b 8a 20 16 00 00 8b 92 1c 16 00 00 48 8b 01 48
RSP: 0018:ffffc9000388f638 EFLAGS: 00000246
RAX: 0000000000000000 RBX: ffffea0001792480 RCX: ffffffff820497c3
RDX: ffff888024f68000 RSI: ffffffff820497ee RDI: 0000000000000007
RBP: ffffea0001792480 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffffea0001792448 R14: 0000000000000000 R15: ffffea0001792480
folio_test_anon include/linux/page-flags.h:723 [inline]
__folio_rmap_sanity_checks.constprop.0+0x18e/0x500 include/linux/rmap.h:467
__folio_try_dup_anon_rmap include/linux/rmap.h:650 [inline]
folio_try_dup_anon_rmap_pte include/linux/rmap.h:740 [inline]
copy_present_ptes mm/memory.c:1036 [inline]
copy_pte_range mm/memory.c:1174 [inline]
copy_pmd_range mm/memory.c:1261 [inline]
copy_pud_range mm/memory.c:1298 [inline]
copy_p4d_range mm/memory.c:1322 [inline]
copy_page_range+0x124c/0x5c80 mm/memory.c:1410
dup_mmap+0xe88/0x21d0 mm/mmap.c:1834
dup_mm kernel/fork.c:1485 [inline]
copy_mm kernel/fork.c:1537 [inline]
copy_process+0x4081/0x7690 kernel/fork.c:2175
kernel_clone+0xfc/0x930 kernel/fork.c:2605
__do_compat_sys_ia32_clone+0xcb/0x110 arch/x86/kernel/sys_ia32.c:254
do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline]
__do_fast_syscall_32+0x7c/0x3a0 arch/x86/entry/syscall_32.c:306
do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:331
entry_SYSENTER_compat_after_hwframe+0x84/0x8e
RIP: 0023:0xf7ff7579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000ff97920c EFLAGS: 00000292 ORIG_RAX: 0000000000000078
RAX: ffffffffffffffda RBX: 0000000001200011 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000577284a8
RBP: 00000000f7484ff4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 11894:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:330 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:356
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4191 [inline]
slab_alloc_node mm/slub.c:4240 [inline]
kmem_cache_alloc_noprof+0x1cb/0x3b0 mm/slub.c:4247
xfrm_state_alloc+0x23/0x5c0 net/xfrm/xfrm_state.c:733
__find_acq_core+0xb59/0x2900 net/xfrm/xfrm_state.c:1833
xfrm_find_acq+0x7b/0xa0 net/xfrm/xfrm_state.c:2353
xfrm_alloc_userspi+0x58e/0xbb0 net/xfrm/xfrm_user.c:1863
xfrm_user_rcv_msg+0x4fe/0xb60 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x155/0x420 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x71/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg net/socket.c:729 [inline]
____sys_sendmsg+0xa95/0xc70 net/socket.c:2614
___sys_sendmsg+0x134/0x1d0 net/socket.c:2668
__sys_sendmsg+0x16d/0x220 net/socket.c:2700
do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline]
__do_fast_syscall_32+0x7c/0x3a0 arch/x86/entry/syscall_32.c:306
do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:331
entry_SYSENTER_compat_after_hwframe+0x84/0x8e
Freed by task 6329:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576
poison_slab_object mm/kasan/common.c:243 [inline]
__kasan_slab_free+0x60/0x70 mm/kasan/common.c:275
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2422 [inline]
slab_free mm/slub.c:4695 [inline]
kmem_cache_free+0x2d1/0x4d0 mm/slub.c:4797
xfrm_state_free net/xfrm/xfrm_state.c:591 [inline]
xfrm_state_gc_destroy net/xfrm/xfrm_state.c:618 [inline]
xfrm_state_gc_task+0x50a/0x770 net/xfrm/xfrm_state.c:634
process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3236
process_scheduled_works kernel/workqueue.c:3319 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
kthread+0x3c5/0x780 kernel/kthread.c:463
ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
The buggy address belongs to the object at ffff888051840440
which belongs to the cache xfrm_state of size 928
The buggy address is located 48 bytes inside of
freed 928-byte region [ffff888051840440, ffff8880518407e0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888051842200 pfn:0x51840
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000040 ffff8880207f63c0 dead000000000122 0000000000000000
raw: ffff888051842200 00000000801e0017 00000000f5000000 0000000000000000
head: 04fff00000000040 ffff8880207f63c0 dead000000000122 0000000000000000
head: ffff888051842200 00000000801e0017 00000000f5000000 0000000000000000
head: 04fff00000000003 ffffea0001461001 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 11832, tgid 11830 (syz.2.2839), ts 95713393605, free_ts 95707049741
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1851
prep_new_page mm/page_alloc.c:1859 [inline]
get_page_from_freelist+0x132b/0x38e0 mm/page_alloc.c:3858
__alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:5148
alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416
alloc_slab_page mm/slub.c:2492 [inline]
allocate_slab mm/slub.c:2660 [inline]
new_slab+0x247/0x330 mm/slub.c:2714
___slab_alloc+0xcf2/0x1750 mm/slub.c:3901
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3992
__slab_alloc_node mm/slub.c:4067 [inline]
slab_alloc_node mm/slub.c:4228 [inline]
kmem_cache_alloc_noprof+0xef/0x3b0 mm/slub.c:4247
xfrm_state_alloc+0x23/0x5c0 net/xfrm/xfrm_state.c:733
__find_acq_core+0xb59/0x2900 net/xfrm/xfrm_state.c:1833
xfrm_find_acq+0x7b/0xa0 net/xfrm/xfrm_state.c:2353
xfrm_alloc_userspi+0x58e/0xbb0 net/xfrm/xfrm_user.c:1863
xfrm_user_rcv_msg+0x4fe/0xb60 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x155/0x420 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x71/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346
page last free pid 23 tgid 23 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0x7d5/0x10f0 mm/page_alloc.c:2895
__folio_put+0x329/0x450 mm/swap.c:112
folio_put include/linux/mm.h:1360 [inline]
put_page include/linux/mm.h:1429 [inline]
put_netmem net/core/skbuff.c:7370 [inline]
skb_page_unref include/linux/skbuff_ref.h:43 [inline]
__skb_frag_unref include/linux/skbuff_ref.h:56 [inline]
skb_release_data+0x81a/0x9e0 net/core/skbuff.c:1080
skb_release_all net/core/skbuff.c:1151 [inline]
__kfree_skb net/core/skbuff.c:1165 [inline]
napi_consume_skb+0x1b7/0x220 net/core/skbuff.c:1475
e1000_unmap_and_free_tx_resource+0x144/0x200 drivers/net/ethernet/intel/e1000/e1000_main.c:1972
e1000_clean_tx_irq drivers/net/ethernet/intel/e1000/e1000_main.c:3864 [inline]
e1000_clean+0x4a0/0x2670 drivers/net/ethernet/intel/e1000/e1000_main.c:3805
__napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:7506
napi_poll net/core/dev.c:7569 [inline]
net_rx_action+0xa9f/0xfe0 net/core/dev.c:7696
handle_softirqs+0x216/0x8e0 kernel/softirq.c:579
run_ksoftirqd kernel/softirq.c:968 [inline]
run_ksoftirqd+0x3a/0x60 kernel/softirq.c:960
smpboot_thread_fn+0x3f7/0xae0 kernel/smpboot.c:160
kthread+0x3c5/0x780 kernel/kthread.c:463
ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Memory state around the buggy address:
ffff888051840300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888051840380: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888051840400: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
^
ffff888051840480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888051840500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: a9 00 01 ff 00 test $0xff0100,%eax
5: 74 1d je 0x24
7: f6 c4 01 test $0x1,%ah
a: 74 43 je 0x4f
c: a9 00 00 0f 00 test $0xf0000,%eax
11: 75 3c jne 0x4f
13: a9 00 00 f0 00 test $0xf00000,%eax
18: 75 35 jne 0x4f
1a: 8b 82 3c 16 00 00 mov 0x163c(%rdx),%eax
20: 85 c0 test %eax,%eax
22: 74 2b je 0x4f
24: 8b 82 18 16 00 00 mov 0x1618(%rdx),%eax
* 2a: 83 f8 02 cmp $0x2,%eax <-- trapping instruction
2d: 75 20 jne 0x4f
2f: 48 8b 8a 20 16 00 00 mov 0x1620(%rdx),%rcx
36: 8b 92 1c 16 00 00 mov 0x161c(%rdx),%edx
3c: 48 8b 01 mov (%rcx),%rax
3f: 48 rex.W