==================================================================
BUG: KASAN: slab-out-of-bounds in decode_session6+0xfc3/0x17f0 net/xfrm/xfrm_policy.c:3375
Read of size 1 at addr ffff888046764667 by task swapper/1/0
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.1.0-rc3-syzkaller-00706-gfbeb229a6622 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15e/0x45d mm/kasan/report.c:395
kasan_report+0xbb/0x1f0 mm/kasan/report.c:495
decode_session6+0xfc3/0x17f0 net/xfrm/xfrm_policy.c:3375
__xfrm_decode_session+0x50/0xb0 net/xfrm/xfrm_policy.c:3481
xfrm_decode_session include/net/xfrm.h:1168 [inline]
xfrmi_xmit+0x175/0x1b90 net/xfrm/xfrm_interface.c:485
__netdev_start_xmit include/linux/netdevice.h:4838 [inline]
netdev_start_xmit include/linux/netdevice.h:4852 [inline]
xmit_one net/core/dev.c:3590 [inline]
dev_hard_start_xmit+0x1be/0x990 net/core/dev.c:3606
sch_direct_xmit+0x19f/0xbe0 net/sched/sch_generic.c:342
qdisc_restart net/sched/sch_generic.c:407 [inline]
__qdisc_run+0x4d6/0x1750 net/sched/sch_generic.c:415
__dev_xmit_skb net/core/dev.c:3880 [inline]
__dev_queue_xmit+0x22a9/0x3b60 net/core/dev.c:4222
dev_queue_xmit include/linux/netdevice.h:3008 [inline]
neigh_connected_output+0x3c0/0x520 net/core/neighbour.c:1581
neigh_output include/net/neighbour.h:546 [inline]
ip6_finish_output2+0x564/0x1520 net/ipv6/ip6_output.c:134
__ip6_finish_output net/ipv6/ip6_output.c:195 [inline]
ip6_finish_output+0x690/0x1160 net/ipv6/ip6_output.c:206
NF_HOOK_COND include/linux/netfilter.h:291 [inline]
ip6_output+0x1ed/0x540 net/ipv6/ip6_output.c:227
dst_output include/net/dst.h:445 [inline]
NF_HOOK include/linux/netfilter.h:302 [inline]
ndisc_send_skb+0xa5f/0x1730 net/ipv6/ndisc.c:508
ndisc_send_rs+0x12e/0x6f0 net/ipv6/ndisc.c:718
addrconf_rs_timer+0x3ed/0x810 net/ipv6/addrconf.c:3931
call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers.part.0+0x6a2/0xaf0 kernel/time/timer.c:1790
__run_timers kernel/time/timer.c:1768 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803
__do_softirq+0x1f7/0xad8 kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1107
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:native_save_fl arch/x86/include/asm/irqflags.h:29 [inline]
RIP: 0010:arch_local_save_flags arch/x86/include/asm/irqflags.h:70 [inline]
RIP: 0010:arch_irqs_disabled arch/x86/include/asm/irqflags.h:130 [inline]
RIP: 0010:acpi_safe_halt drivers/acpi/processor_idle.c:113 [inline]
RIP: 0010:acpi_idle_do_entry+0x1fd/0x2a0 drivers/acpi/processor_idle.c:572
Code: 89 de e8 76 d6 e9 f7 84 db 75 ac e8 dd d9 e9 f7 e8 98 50 f0 f7 66 90 e8 d1 d9 e9 f7 0f 00 2d 0a d2 c1 00 e8 c5 d9 e9 f7 fb f4 <9c> 5b 81 e3 00 02 00 00 fa 31 ff 48 89 de e8 a0 d6 e9 f7 48 85 db
RSP: 0018:ffffc90000177d10 EFLAGS: 00000293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff888011a81d40 RSI: ffffffff8992d85b RDI: 0000000000000000
RBP: ffff88814596a064 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
R13: ffff88814596a000 R14: ffff88814596a064 R15: ffff888145fad804
acpi_idle_enter+0x364/0x500 drivers/acpi/processor_idle.c:709
cpuidle_enter_state+0x1ab/0xd30 drivers/cpuidle/cpuidle.c:239
cpuidle_enter+0x4a/0xa0 drivers/cpuidle/cpuidle.c:356
call_cpuidle kernel/sched/idle.c:155 [inline]
cpuidle_idle_call kernel/sched/idle.c:236 [inline]
do_idle+0x3f7/0x590 kernel/sched/idle.c:303
cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:400
start_secondary+0x252/0x300 arch/x86/kernel/smpboot.c:262
secondary_startup_64_no_verify+0xce/0xdb
Allocated by task 3642:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45
kasan_set_track+0x21/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:371 [inline]
____kasan_kmalloc mm/kasan/common.c:330 [inline]
__kasan_kmalloc+0xa1/0xb0 mm/kasan/common.c:380
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc_node+0x57/0xc0 mm/slab_common.c:962
kmalloc_node include/linux/slab.h:602 [inline]
kvmalloc_node+0x3f/0x1b0 mm/util.c:581
kvmalloc include/linux/slab.h:729 [inline]
kvzalloc include/linux/slab.h:737 [inline]
netif_alloc_netdev_queues net/core/dev.c:9921 [inline]
alloc_netdev_mqs+0x9ba/0x1180 net/core/dev.c:10648
nsim_create+0x91/0x520 drivers/net/netdevsim/netdev.c:350
__nsim_dev_port_add+0x2d7/0x8f0 drivers/net/netdevsim/dev.c:1396
nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1454 [inline]
nsim_drv_probe+0xd80/0x1320 drivers/net/netdevsim/dev.c:1608
call_driver_probe drivers/base/dd.c:560 [inline]
really_probe+0x249/0xb90 drivers/base/dd.c:639
__driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778
driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:808
__device_attach_driver+0x1d0/0x2e0 drivers/base/dd.c:936
bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
__device_attach+0x1e4/0x530 drivers/base/dd.c:1008
bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
device_add+0xbd5/0x1e90 drivers/base/core.c:3517
nsim_bus_dev_new drivers/net/netdevsim/bus.c:290 [inline]
new_device_store+0x3fa/0x660 drivers/net/netdevsim/bus.c:167
bus_attr_store+0x72/0xa0 drivers/base/bus.c:122
sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136
kernfs_fop_write_iter+0x3f8/0x610 fs/kernfs/file.c:330
call_write_iter include/linux/fs.h:2191 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x9e9/0xdd0 fs/read_write.c:584
ksys_write+0x127/0x250 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff888046764400
which belongs to the cache kmalloc-cg-512 of size 512
The buggy address is located 103 bytes to the right of
512-byte region [ffff888046764400, ffff888046764600)
The buggy address belongs to the physical page:
page:ffffea000119d900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x46764
head:ffffea000119d900 order:2 compound_mapcount:0 compound_pincount:0
memcg:ffff88807451d801
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888011842dc0
raw: 0000000000000000 0000000000100010 00000001ffffffff ffff88807451d801
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2957, tgid 2957 (klogd), ts 146037072092, free_ts 18397780268
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288
__alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5555
alloc_pages+0x1a6/0x270 mm/mempolicy.c:2285
alloc_slab_page mm/slub.c:1794 [inline]
allocate_slab+0x213/0x300 mm/slub.c:1939
new_slab mm/slub.c:1992 [inline]
___slab_alloc+0xa91/0x1400 mm/slub.c:3180
__slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x191/0x3e0 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:954 [inline]
__kmalloc_node_track_caller+0x45/0xc0 mm/slab_common.c:975
kmalloc_reserve net/core/skbuff.c:438 [inline]
__alloc_skb+0xe5/0x310 net/core/skbuff.c:511
alloc_skb include/linux/skbuff.h:1267 [inline]
alloc_skb_with_frags+0x93/0x6c0 net/core/skbuff.c:6137
sock_alloc_send_pskb+0x7a3/0x930 net/core/sock.c:2733
unix_dgram_sendmsg+0x415/0x1b50 net/unix/af_unix.c:1943
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:734
__sys_sendto+0x236/0x340 net/socket.c:2117
__do_sys_sendto net/socket.c:2129 [inline]
__se_sys_sendto net/socket.c:2125 [inline]
__x64_sys_sendto+0xdd/0x1b0 net/socket.c:2125
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509
free_unref_page_prepare mm/page_alloc.c:3387 [inline]
free_unref_page+0x19/0x4d0 mm/page_alloc.c:3483
free_contig_range+0xb1/0x180 mm/page_alloc.c:9493
destroy_args+0xa8/0x64c mm/debug_vm_pgtable.c:1031
debug_vm_pgtable+0x2954/0x29e5 mm/debug_vm_pgtable.c:1354
do_one_initcall+0x13d/0x780 init/main.c:1303
do_initcall_level init/main.c:1376 [inline]
do_initcalls init/main.c:1392 [inline]
do_basic_setup init/main.c:1411 [inline]
kernel_init_freeable+0x6ff/0x788 init/main.c:1631
kernel_init+0x1a/0x1d0 init/main.c:1519
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
Memory state around the buggy address:
ffff888046764500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888046764580: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff888046764600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888046764680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888046764700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 89 de mov %ebx,%esi
2: e8 76 d6 e9 f7 callq 0xf7e9d67d
7: 84 db test %bl,%bl
9: 75 ac jne 0xffffffb7
b: e8 dd d9 e9 f7 callq 0xf7e9d9ed
10: e8 98 50 f0 f7 callq 0xf7f050ad
15: 66 90 xchg %ax,%ax
17: e8 d1 d9 e9 f7 callq 0xf7e9d9ed
1c: 0f 00 2d 0a d2 c1 00 verw 0xc1d20a(%rip) # 0xc1d22d
23: e8 c5 d9 e9 f7 callq 0xf7e9d9ed
28: fb sti
29: f4 hlt
* 2a: 9c pushfq <-- trapping instruction
2b: 5b pop %rbx
2c: 81 e3 00 02 00 00 and $0x200,%ebx
32: fa cli
33: 31 ff xor %edi,%edi
35: 48 89 de mov %rbx,%rsi
38: e8 a0 d6 e9 f7 callq 0xf7e9d6dd
3d: 48 85 db test %rbx,%rbx