================================================================== BUG: KASAN: use-after-free in decode_session6+0xfe0/0x1830 net/xfrm/xfrm_policy.c:3371 Read of size 1 at addr ffff88807cd024df by task syz-executor.2/6442 CPU: 0 PID: 6442 Comm: syz-executor.2 Tainted: G W 5.17.0-syzkaller-11406-gf82da161ea75 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 decode_session6+0xfe0/0x1830 net/xfrm/xfrm_policy.c:3371 __xfrm_decode_session+0x50/0xb0 net/xfrm/xfrm_policy.c:3477 xfrm_decode_session include/net/xfrm.h:1144 [inline] vti_tunnel_xmit+0x266/0x1b80 net/ipv4/ip_vti.c:294 __netdev_start_xmit include/linux/netdevice.h:4788 [inline] netdev_start_xmit include/linux/netdevice.h:4802 [inline] xmit_one net/core/dev.c:3532 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3548 sch_direct_xmit+0x19f/0xbe0 net/sched/sch_generic.c:342 qdisc_restart net/sched/sch_generic.c:407 [inline] __qdisc_run+0x4c0/0x1720 net/sched/sch_generic.c:415 __dev_xmit_skb net/core/dev.c:3822 [inline] __dev_queue_xmit+0x21b7/0x39c0 net/core/dev.c:4141 __bpf_tx_skb net/core/filter.c:2113 [inline] __bpf_redirect_no_mac net/core/filter.c:2138 [inline] __bpf_redirect+0x83f/0xf00 net/core/filter.c:2161 ____bpf_clone_redirect net/core/filter.c:2428 [inline] bpf_clone_redirect+0x2ae/0x420 net/core/filter.c:2400 bpf_prog_d316f300328954fc+0x56/0x5b bpf_dispatcher_nop_func include/linux/bpf.h:804 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] bpf_test_run+0x386/0x9d0 net/bpf/test_run.c:401 bpf_prog_test_run_skb+0xb67/0x1e20 net/bpf/test_run.c:1110 bpf_prog_test_run kernel/bpf/syscall.c:3369 [inline] __sys_bpf+0x183c/0x55d0 kernel/bpf/syscall.c:4681 __do_sys_bpf kernel/bpf/syscall.c:4767 [inline] __se_sys_bpf kernel/bpf/syscall.c:4765 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4765 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f211b489049 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f211c5e6168 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f211b59c100 RCX: 00007f211b489049 RDX: 0000000000000048 RSI: 0000000020000040 RDI: 000000000000000a RBP: 00007f211b4e308d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd67a2353f R14: 00007f211c5e6300 R15: 0000000000022000 Allocated by task 2849: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_krealloc+0x10e/0x190 mm/kasan/common.c:583 kasan_krealloc include/linux/kasan.h:254 [inline] __do_krealloc mm/slab_common.c:1180 [inline] krealloc+0x54/0xf0 mm/slab_common.c:1217 push_jmp_history kernel/bpf/verifier.c:2334 [inline] is_state_visited kernel/bpf/verifier.c:11336 [inline] do_check kernel/bpf/verifier.c:11472 [inline] do_check_common+0x38ef/0xcfc0 kernel/bpf/verifier.c:13845 do_check_main kernel/bpf/verifier.c:13908 [inline] bpf_check+0x88ac/0xbb20 kernel/bpf/verifier.c:14477 bpf_prog_load+0xfb2/0x2250 kernel/bpf/syscall.c:2351 __sys_bpf+0x674/0x55d0 kernel/bpf/syscall.c:4663 __do_sys_bpf kernel/bpf/syscall.c:4767 [inline] __se_sys_bpf kernel/bpf/syscall.c:4765 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4765 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x62e/0x1140 kernel/workqueue.c:1517 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421 expire_timers kernel/time/timer.c:1461 [inline] __run_timers.part.0+0x4a6/0xa30 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x62e/0x1140 kernel/workqueue.c:1517 queue_work_on+0xee/0x110 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:502 [inline] tipc_topsrv_queue_evt+0x3ae/0x640 net/tipc/topsrv.c:334 tipc_sub_send_event net/tipc/subscr.c:63 [inline] tipc_sub_report_overlap+0x53e/0x9e0 net/tipc/subscr.c:102 tipc_service_insert_publ net/tipc/name_table.c:366 [inline] tipc_nametbl_insert_publ+0xb12/0x14d0 net/tipc/name_table.c:491 tipc_nametbl_publish+0x310/0x6e0 net/tipc/name_table.c:776 tipc_sk_publish+0x2c9/0x690 net/tipc/socket.c:2915 tipc_sk_join net/tipc/socket.c:3093 [inline] tipc_setsockopt+0x5f4/0xe70 net/tipc/socket.c:3200 __sys_setsockopt+0x234/0x610 net/socket.c:2180 __do_sys_setsockopt net/socket.c:2191 [inline] __se_sys_setsockopt net/socket.c:2188 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2188 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88807cd02400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 223 bytes inside of 512-byte region [ffff88807cd02400, ffff88807cd02600) The buggy address belongs to the physical page: page:ffffea0001f34000 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807cd03000 pfn:0x7cd00 head:ffffea0001f34000 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001665208 ffffea0001e2ab08 ffff888010c41c80 raw: ffff88807cd03000 0000000000100006 00000001ffffffff 0000000000000000 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 2978, tgid 2978 (udevadm), ts 13454564217, free_ts 13327610511 prep_new_page mm/page_alloc.c:2438 [inline] get_page_from_freelist+0xba2/0x3df0 mm/page_alloc.c:4179 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5405 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2262 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8df/0xf20 mm/slub.c:3005 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092 slab_alloc_node mm/slub.c:3183 [inline] slab_alloc mm/slub.c:3225 [inline] kmem_cache_alloc_trace+0x310/0x3f0 mm/slub.c:3256 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] kernfs_fop_open+0x317/0xe00 fs/kernfs/file.c:628 do_dentry_open+0x4a1/0x11e0 fs/open.c:824 do_open fs/namei.c:3476 [inline] path_openat+0x1c71/0x2910 fs/namei.c:3609 do_filp_open+0x1aa/0x400 fs/namei.c:3636 do_sys_openat2+0x16d/0x4c0 fs/open.c:1213 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1240 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1353 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1403 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3420 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2523 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:749 [inline] slab_alloc_node mm/slub.c:3217 [inline] slab_alloc mm/slub.c:3225 [inline] __kmem_cache_alloc_lru mm/slub.c:3232 [inline] kmem_cache_alloc+0x204/0x3b0 mm/slub.c:3242 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138 getname_flags include/linux/audit.h:323 [inline] getname+0x8e/0xd0 fs/namei.c:217 do_sys_openat2+0xf5/0x4c0 fs/open.c:1207 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1240 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff88807cd02380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807cd02400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807cd02480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807cd02500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807cd02580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================