================================================================== BUG: KASAN: slab-out-of-bounds in decode_session6+0x103f/0x1890 net/xfrm/xfrm_policy.c:3451 Read of size 1 at addr ffff888079940f38 by task syz-executor249/7500 CPU: 1 PID: 7500 Comm: syz-executor249 Not tainted 6.4.0-rc6-syzkaller-01349-g712557f21072 #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] vti6_tnl_xmit+0x3e6/0x1ee0 net/ipv6/ip6_vti.c:575 __netdev_start_xmit include/linux/netdevice.h:4910 [inline] netdev_start_xmit include/linux/netdevice.h:4924 [inline] xmit_one net/core/dev.c:3537 [inline] dev_hard_start_xmit+0x187/0x700 net/core/dev.c:3553 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:3827 [inline] __dev_queue_xmit+0x2215/0x3b10 net/core/dev.c:4169 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:135 __ip6_finish_output net/ipv6/ip6_output.c:196 [inline] ip6_finish_output+0x69a/0x1170 net/ipv6/ip6_output.c:207 NF_HOOK_COND include/linux/netfilter.h:292 [inline] ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:228 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:string_nocheck lib/vsprintf.c:643 [inline] RIP: 0010:string+0x10c/0x3d0 lib/vsprintf.c:726 Code: ff 48 89 de e8 15 4b 7f f7 48 81 fb 00 e0 ff ff 0f 87 48 01 00 00 e8 c3 4e 7f f7 48 8b 44 24 40 31 ff 45 31 ff 48 89 44 24 18 <41> 0f bf c4 89 c6 89 44 24 04 e8 c5 4a 7f f7 66 45 85 e4 0f 84 be RSP: 0018:ffffc9000cf4f498 EFLAGS: 00000246 RAX: ffff0a00ffffff04 RBX: ffffffff8a9f35a0 RCX: 0000000000000000 RDX: ffff888079538000 RSI: ffffffff8a04f81d RDI: 0000000000000000 RBP: 0000000000000005 R08: 0000000000000007 R09: ffffffffffffe000 R10: ffffffff8a9f35a0 R11: 0000000000094001 R12: 00000000ffffffff R13: 0000000000000000 R14: ffffffff8a9f45a0 R15: 0000000000000000 vsnprintf+0xa36/0x1710 lib/vsprintf.c:2817 tomoyo_supervisor+0xfe/0xec0 security/tomoyo/common.c:2060 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x270/0x3a0 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x337/0x3a0 security/tomoyo/file.c:780 tomoyo_file_open security/tomoyo/tomoyo.c:332 [inline] tomoyo_file_open+0xa1/0xc0 security/tomoyo/tomoyo.c:327 security_file_open+0x49/0xb0 security/security.c:2797 do_dentry_open+0x575/0x13f0 fs/open.c:907 do_open fs/namei.c:3636 [inline] path_openat+0x1baa/0x2750 fs/namei.c:3791 do_filp_open+0x1ba/0x410 fs/namei.c:3818 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1383 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:0x7f8071d6cb07 Code: 25 00 00 41 00 3d 00 00 41 00 74 47 64 8b 04 25 18 00 00 00 85 c0 75 6b 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 95 00 00 00 48 8b 4c 24 28 64 48 2b 0c 25 RSP: 002b:00007ffc0467ea20 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f8071d6cb07 RDX: 0000000000080001 RSI: 00007f8071df43a5 RDI: 00000000ffffff9c RBP: 00007f8071df43a5 R08: 0000000000000000 R09: 00007ffc0467ea10 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080001 R13: 0000000000000000 R14: 0000000000015fda R15: 00007ffc0467efa4 Allocated by task 7082: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] ____kasan_kmalloc mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc+0x5e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] sk_prot_alloc+0x140/0x290 net/core/sock.c:2083 sk_alloc+0x3a/0x7f0 net/core/sock.c:2136 __netlink_create+0x63/0x380 net/netlink/af_netlink.c:649 netlink_create+0x3b1/0x5f0 net/netlink/af_netlink.c:712 __sock_create+0x380/0x850 net/socket.c:1535 sock_create net/socket.c:1586 [inline] __sys_socket_create net/socket.c:1623 [inline] __sys_socket_create net/socket.c:1608 [inline] __sys_socket+0x133/0x250 net/socket.c:1651 __do_sys_socket net/socket.c:1664 [inline] __se_sys_socket net/socket.c:1662 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1662 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 21: 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+0xaf/0x2d0 mm/slub.c:3799 sk_prot_free net/core/sock.c:2119 [inline] __sk_destruct+0x5fc/0x770 net/core/sock.c:2211 sk_destruct net/core/sock.c:2226 [inline] __sk_free+0x175/0x460 net/core/sock.c:2237 sk_free+0x7c/0xa0 net/core/sock.c:2248 deferred_put_nlk_sk+0x155/0x2f0 net/netlink/af_netlink.c:747 rcu_do_batch kernel/rcu/tree.c:2115 [inline] rcu_core+0x806/0x1ad0 kernel/rcu/tree.c:2377 __do_softirq+0x1d4/0x905 kernel/softirq.c:571 Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491 __call_rcu_common.constprop.0+0x99/0x7e0 kernel/rcu/tree.c:2627 netlink_release+0xcde/0x1e40 net/netlink/af_netlink.c:828 __sock_release+0xcd/0x290 net/socket.c:653 sock_close+0x1c/0x20 net/socket.c:1385 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888079940000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1848 bytes to the right of allocated 2048-byte region [ffff888079940000, ffff888079940800) The buggy address belongs to the physical page: page:ffffea0001e65000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x79940 head:ffffea0001e65000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012442000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000080008 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 7082, tgid 7082 (syz-executor249), ts 88045289408, free_ts 87953557862 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 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291 __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0x4e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] sk_prot_alloc+0x140/0x290 net/core/sock.c:2083 sk_alloc+0x3a/0x7f0 net/core/sock.c:2136 __netlink_create+0x63/0x380 net/netlink/af_netlink.c:649 netlink_create+0x3b1/0x5f0 net/netlink/af_netlink.c:712 __sock_create+0x380/0x850 net/socket.c:1535 sock_create net/socket.c:1586 [inline] __sys_socket_create net/socket.c:1623 [inline] __sys_socket_create net/socket.c:1608 [inline] __sys_socket+0x133/0x250 net/socket.c:1651 __do_sys_socket net/socket.c:1664 [inline] __se_sys_socket net/socket.c:1662 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1662 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+0x185/0x3e0 mm/slub.c:3496 alloc_task_struct_node kernel/fork.c:173 [inline] dup_task_struct kernel/fork.c:1108 [inline] copy_process+0x3c0/0x75c0 kernel/fork.c:2333 kernel_clone+0xeb/0x890 kernel/fork.c:2915 __do_sys_clone+0xba/0x100 kernel/fork.c:3058 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: ffff888079940e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888079940e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888079940f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888079940f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888079941000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: ff 48 89 decl -0x77(%rax) 3: de e8 fsubrp %st,%st(0) 5: 15 4b 7f f7 48 adc $0x48f77f4b,%eax a: 81 fb 00 e0 ff ff cmp $0xffffe000,%ebx 10: 0f 87 48 01 00 00 ja 0x15e 16: e8 c3 4e 7f f7 callq 0xf77f4ede 1b: 48 8b 44 24 40 mov 0x40(%rsp),%rax 20: 31 ff xor %edi,%edi 22: 45 31 ff xor %r15d,%r15d 25: 48 89 44 24 18 mov %rax,0x18(%rsp) * 2a: 41 0f bf c4 movswl %r12w,%eax <-- trapping instruction 2e: 89 c6 mov %eax,%esi 30: 89 44 24 04 mov %eax,0x4(%rsp) 34: e8 c5 4a 7f f7 callq 0xf77f4afe 39: 66 45 85 e4 test %r12w,%r12w 3d: 0f .byte 0xf 3e: 84 .byte 0x84 3f: be .byte 0xbe