==================================================================
BUG: KASAN: slab-use-after-free in decode_session6+0x103f/0x1890 net/xfrm/xfrm_policy.c:3451
Read of size 1 at addr ffff88802bead0e7 by task syz-executor299/7191
CPU: 1 PID: 7191 Comm: syz-executor299 Not tainted 6.4.0-rc6-syzkaller-00224-g9a43827e876c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
print_report mm/kasan/report.c:462 [inline]
kasan_report+0x11c/0x130 mm/kasan/report.c:572
decode_session6+0x103f/0x1890 net/xfrm/xfrm_policy.c:3451
__xfrm_decode_session+0x54/0xb0 net/xfrm/xfrm_policy.c:3557
xfrm_decode_session include/net/xfrm.h:1215 [inline]
xfrmi_xmit+0x173/0x1ca0 net/xfrm/xfrm_interface_core.c:493
__netdev_start_xmit include/linux/netdevice.h:4918 [inline]
netdev_start_xmit include/linux/netdevice.h:4932 [inline]
xmit_one net/core/dev.c:3578 [inline]
dev_hard_start_xmit+0x187/0x700 net/core/dev.c:3594
sch_direct_xmit+0x1a3/0xc30 net/sched/sch_generic.c:342
qdisc_restart net/sched/sch_generic.c:407 [inline]
__qdisc_run+0x510/0x1780 net/sched/sch_generic.c:415
__dev_xmit_skb net/core/dev.c:3868 [inline]
__dev_queue_xmit+0x2215/0x3b10 net/core/dev.c:4210
dev_queue_xmit include/linux/netdevice.h:3088 [inline]
neigh_connected_output+0x3c2/0x550 net/core/neighbour.c:1581
neigh_output include/net/neighbour.h:544 [inline]
ip6_finish_output2+0x55a/0x1560 net/ipv6/ip6_output.c:134
__ip6_finish_output net/ipv6/ip6_output.c:195 [inline]
ip6_finish_output+0x69a/0x1170 net/ipv6/ip6_output.c:206
NF_HOOK_COND include/linux/netfilter.h:292 [inline]
ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:227
dst_output include/net/dst.h:458 [inline]
NF_HOOK include/linux/netfilter.h:303 [inline]
ndisc_send_skb+0xa63/0x1850 net/ipv6/ndisc.c:508
ndisc_send_rs+0x132/0x6f0 net/ipv6/ndisc.c:718
addrconf_rs_timer+0x3f1/0x870 net/ipv6/addrconf.c:3936
call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700
expire_timers+0x29b/0x4b0 kernel/time/timer.c:1751
__run_timers kernel/time/timer.c:2022 [inline]
__run_timers kernel/time/timer.c:1995 [inline]
run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035
__do_softirq+0x1d4/0x905 kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x114/0x190 kernel/softirq.c:650
irq_exit_rcu+0x9/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x97/0xc0 arch/x86/kernel/apic/apic.c:1106
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:stack_trace_consume_entry+0x5c/0x160 kernel/stacktrace.c:86
Code: 48 8d 7b 08 8b 6b 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e a5 00 00 00 31 c0 <3b> 6b 08 0f 83 81 00 00 00 48 8d 7b 0c 48 b8 00 00 00 00 00 fc ff
RSP: 0018:ffffc9000de57648 EFLAGS: 00000246
RAX: 0000000000000000 RBX: ffffc9000de57720 RCX: 0000000000000000
RDX: 1ffff92001bcaee5 RSI: ffffffff81caebfe RDI: ffffc9000de57728
RBP: 0000000000000000 R08: 0000000000000001 R09: ffffc9000de578e0
R10: ffffc9000de57668 R11: 0000000000094001 R12: ffffc9000de57720
R13: 0000000000000000 R14: ffff888079c78000 R15: 0000001406ce6869
arch_stack_walk+0x71/0xf0 arch/x86/kernel/stacktrace.c:27
stack_trace_save+0x90/0xc0 kernel/stacktrace.c:122
save_stack+0x151/0x1e0 mm/page_owner.c:128
__reset_page_owner+0x56/0x170 mm/page_owner.c:149
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1302 [inline]
free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2564
free_unref_page_list+0xe3/0xa70 mm/page_alloc.c:2705
release_pages+0xcd8/0x1380 mm/swap.c:1042
folios_put include/linux/mm.h:1486 [inline]
folio_batch_move_lru+0x2b7/0x400 mm/swap.c:224
lru_add_drain_cpu+0x56f/0x850 mm/swap.c:652
lru_add_drain+0x10c/0x440 mm/swap.c:752
exit_mmap+0x163/0x930 mm/mmap.c:3106
__mmput+0x128/0x4c0 kernel/fork.c:1351
mmput+0x60/0x70 kernel/fork.c:1373
exit_mm kernel/exit.c:567 [inline]
do_exit+0x9b0/0x29b0 kernel/exit.c:861
do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fc8e73f68f9
Code: Unable to access opcode bytes at 0x7fc8e73f68cf.
RSP: 002b:00007ffdf16edfa8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007fc8e7471410 RCX: 00007fc8e73f68f9
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 000000000000000d
R10: 000000000000000d R11: 0000000000000246 R12: 00007fc8e7471410
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
Allocated by task 4989:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
__kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook mm/slab.h:711 [inline]
kmem_cache_alloc_bulk+0x424/0x860 mm/slub.c:4033
mt_alloc_bulk lib/maple_tree.c:164 [inline]
mas_alloc_nodes+0x332/0x880 lib/maple_tree.c:1309
mas_node_count_gfp lib/maple_tree.c:1367 [inline]
mas_preallocate+0x1bb/0x360 lib/maple_tree.c:5775
vma_iter_prealloc mm/internal.h:1029 [inline]
mmap_region+0x84c/0x28d0 mm/mmap.c:2711
do_mmap+0x831/0xf60 mm/mmap.c:1394
vm_mmap_pgoff+0x1a2/0x3b0 mm/util.c:543
ksys_mmap_pgoff+0x41f/0x5a0 mm/mmap.c:1440
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 4989:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:162 [inline]
slab_free_hook mm/slub.c:1781 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
slab_free mm/slub.c:3786 [inline]
kmem_cache_free_bulk.part.0+0x20c/0x680 mm/slub.c:3904
mt_free_bulk lib/maple_tree.c:169 [inline]
mas_destroy+0x440/0xbd0 lib/maple_tree.c:5830
mas_store_prealloc+0xf0/0x150 lib/maple_tree.c:5760
vma_iter_store mm/internal.h:1070 [inline]
mmap_region+0xb70/0x28d0 mm/mmap.c:2717
do_mmap+0x831/0xf60 mm/mmap.c:1394
vm_mmap_pgoff+0x1a2/0x3b0 mm/util.c:543
ksys_mmap_pgoff+0x41f/0x5a0 mm/mmap.c:1440
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff88802bead000
which belongs to the cache maple_node of size 256
The buggy address is located 231 bytes inside of
freed 256-byte region [ffff88802bead000, ffff88802bead100)
The buggy address belongs to the physical page:
page:ffffea0000afab00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2beac
head:ffffea0000afab00 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff888012e4d000 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4689, tgid 4689 (dhcpcd-run-hook), ts 47252293254, free_ts 44022283595
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
prep_new_page mm/page_alloc.c:1738 [inline]
get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502
__alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768
alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
alloc_slab_page mm/slub.c:1851 [inline]
allocate_slab+0x25f/0x390 mm/slub.c:1998
new_slab mm/slub.c:2051 [inline]
___slab_alloc+0xa91/0x1400 mm/slub.c:3192
__kmem_cache_alloc_bulk mm/slub.c:3951 [inline]
kmem_cache_alloc_bulk+0x270/0x860 mm/slub.c:4026
mt_alloc_bulk lib/maple_tree.c:164 [inline]
mas_alloc_nodes+0x332/0x880 lib/maple_tree.c:1309
mas_node_count_gfp lib/maple_tree.c:1367 [inline]
mas_preallocate+0x1bb/0x360 lib/maple_tree.c:5775
vma_iter_prealloc mm/internal.h:1029 [inline]
__split_vma+0x1b7/0x830 mm/mmap.c:2253
do_vmi_align_munmap+0x400/0x1580 mm/mmap.c:2398
do_vmi_munmap+0x26e/0x2c0 mm/mmap.c:2530
mmap_region+0x1f0/0x28d0 mm/mmap.c:2578
do_mmap+0x831/0xf60 mm/mmap.c:1394
vm_mmap_pgoff+0x1a2/0x3b0 mm/util.c:543
ksys_mmap_pgoff+0x41f/0x5a0 mm/mmap.c:1440
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+0x62e/0xcb0 mm/page_alloc.c:2564
free_unref_page+0x33/0x370 mm/page_alloc.c:2659
qlink_free mm/kasan/quarantine.c:166 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook mm/slab.h:711 [inline]
slab_alloc_node mm/slub.c:3451 [inline]
__kmem_cache_alloc_node+0x17c/0x320 mm/slub.c:3490
__do_kmalloc_node mm/slab_common.c:965 [inline]
__kmalloc_node+0x51/0x1a0 mm/slab_common.c:973
kmalloc_node include/linux/slab.h:579 [inline]
kvmalloc_node+0xa2/0x1a0 mm/util.c:604
kvmalloc include/linux/slab.h:697 [inline]
seq_buf_alloc fs/seq_file.c:38 [inline]
seq_read_iter+0x7fb/0x12d0 fs/seq_file.c:210
kernfs_fop_read_iter+0x4ce/0x690 fs/kernfs/file.c:279
call_read_iter include/linux/fs.h:1862 [inline]
new_sync_read fs/read_write.c:389 [inline]
vfs_read+0x4b1/0x8a0 fs/read_write.c:470
ksys_read+0x12b/0x250 fs/read_write.c:613
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Memory state around the buggy address:
ffff88802beacf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802bead000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802bead080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88802bead100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802bead180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 48 8d 7b 08 lea 0x8(%rbx),%rdi
4: 8b 6b 10 mov 0x10(%rbx),%ebp
7: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
e: fc ff df
11: 48 89 fa mov %rdi,%rdx
14: 48 c1 ea 03 shr $0x3,%rdx
18: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
1c: 84 c0 test %al,%al
1e: 74 08 je 0x28
20: 3c 03 cmp $0x3,%al
22: 0f 8e a5 00 00 00 jle 0xcd
28: 31 c0 xor %eax,%eax
* 2a: 3b 6b 08 cmp 0x8(%rbx),%ebp <-- trapping instruction
2d: 0f 83 81 00 00 00 jae 0xb4
33: 48 8d 7b 0c lea 0xc(%rbx),%rdi
37: 48 rex.W
38: b8 00 00 00 00 mov $0x0,%eax
3d: 00 fc add %bh,%ah
3f: ff .byte 0xff