================================================================== BUG: KASAN: slab-out-of-bounds in decode_session6 net/xfrm/xfrm_policy.c:3371 [inline] BUG: KASAN: slab-out-of-bounds in __xfrm_decode_session+0x1843/0x21c0 net/xfrm/xfrm_policy.c:3458 Read of size 1 at addr ffff8880155ff985 by task syz-executor.1/9600 CPU: 0 PID: 9600 Comm: syz-executor.1 Not tainted 5.15.0-rc2-syzkaller #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+0x1dc/0x2d8 lib/dump_stack.c:106 print_address_description+0x66/0x3e0 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report+0x19a/0x1f0 mm/kasan/report.c:459 decode_session6 net/xfrm/xfrm_policy.c:3371 [inline] __xfrm_decode_session+0x1843/0x21c0 net/xfrm/xfrm_policy.c:3458 vti_tunnel_xmit+0x275/0x17f0 __netdev_start_xmit include/linux/netdevice.h:4988 [inline] netdev_start_xmit include/linux/netdevice.h:5002 [inline] xmit_one net/core/dev.c:3576 [inline] dev_hard_start_xmit+0x20b/0x450 net/core/dev.c:3592 sch_direct_xmit+0x292/0x5b0 net/sched/sch_generic.c:342 qdisc_restart net/sched/sch_generic.c:407 [inline] __qdisc_run+0x9dc/0x1cd0 net/sched/sch_generic.c:415 __dev_xmit_skb net/core/dev.c:3861 [inline] __dev_queue_xmit+0xe8b/0x34c0 net/core/dev.c:4170 neigh_output include/net/neighbour.h:510 [inline] ip6_finish_output2+0xf07/0x14c0 net/ipv6/ip6_output.c:126 dst_output include/net/dst.h:450 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] ndisc_send_skb+0xa2f/0xf00 net/ipv6/ndisc.c:508 addrconf_rs_timer+0x34d/0x7b0 net/ipv6/addrconf.c:3893 call_timer_fn+0xf6/0x210 kernel/time/timer.c:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers+0x71a/0x910 kernel/time/timer.c:1734 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1747 __do_softirq+0x392/0x7a3 kernel/softirq.c:558 __irq_exit_rcu+0xec/0x170 kernel/softirq.c:636 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 RIP: 0010:preempt_count arch/x86/include/asm/preempt.h:27 [inline] RIP: 0010:check_kcov_mode kernel/kcov.c:163 [inline] RIP: 0010:write_comp_data kernel/kcov.c:218 [inline] RIP: 0010:__sanitizer_cov_trace_const_cmp4+0xd/0xa0 kernel/kcov.c:284 Code: 34 01 4c 89 44 f9 18 49 ff c2 4c 89 11 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 4c 8b 04 24 65 48 8b 14 25 c0 ef 01 00 <65> 8b 05 24 76 7f 7e a9 00 01 ff 00 74 10 a9 00 01 00 00 74 6e 83 RSP: 0000:ffffc90004c7fdf8 EFLAGS: 00000293 RAX: ffffffff81b9281e RBX: 0000000000000000 RCX: ffff888082dd8000 RDX: ffff888082dd8000 RSI: 0000000000000002 RDI: 0000000000000004 RBP: 0000000000000002 R08: ffffffff81b92875 R09: ffffed101076c018 R10: ffffed101076c018 R11: 0000000000000000 R12: ffff888082dd8000 R13: 0000000000000001 R14: 00007f8c5c65dc60 R15: dffffc0000000000 vmacache_find+0x445/0x5d0 mm/vmacache.c:84 find_vma+0xc5/0x230 mm/mmap.c:2280 do_user_addr_fault+0x6e1/0x10c0 arch/x86/mm/fault.c:1351 handle_page_fault arch/x86/mm/fault.c:1475 [inline] exc_page_fault+0xa1/0x1e0 arch/x86/mm/fault.c:1531 asm_exc_page_fault+0x1e/0x30 RIP: 0033:0x7f8c5c65dc60 Code: Unable to access opcode bytes at RIP 0x7f8c5c65dc36. RSP: 002b:00007fff1697f418 EFLAGS: 00010246 RAX: 00007f8c5c7775e0 RBX: 0000000000000000 RCX: 00007f8c5c7775e0 RDX: 0000000000000000 RSI: 00007f8c5c7775e0 RDI: 0000000000000000 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000555555e85400 R10: 0000555555e856d0 R11: 0000000000000202 R12: 0000000000000001 R13: 0000000000000000 R14: 0000000000000001 R15: 00007fff1697f510 Allocated by task 2966: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] __kmalloc+0x24d/0x370 mm/slub.c:4391 kmalloc include/linux/slab.h:596 [inline] tomoyo_realpath_from_path+0xd8/0x610 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x22f/0x490 security/tomoyo/file.c:771 security_file_open+0x50/0x570 security/security.c:1634 do_dentry_open+0x36c/0x1020 fs/open.c:809 do_open fs/namei.c:3428 [inline] path_openat+0x28b4/0x3670 fs/namei.c:3561 do_filp_open+0x277/0x4f0 fs/namei.c:3588 do_sys_openat2+0x13b/0x500 fs/open.c:1200 do_sys_open fs/open.c:1216 [inline] __do_sys_open fs/open.c:1224 [inline] __se_sys_open fs/open.c:1220 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1220 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 2966: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0x10d/0x150 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1700 [inline] slab_free_freelist_hook+0x129/0x1a0 mm/slub.c:1725 slab_free mm/slub.c:3483 [inline] kfree+0xcf/0x2f0 mm/slub.c:4543 tomoyo_realpath_from_path+0x5ce/0x610 security/tomoyo/realpath.c:291 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x22f/0x490 security/tomoyo/file.c:771 security_file_open+0x50/0x570 security/security.c:1634 do_dentry_open+0x36c/0x1020 fs/open.c:809 do_open fs/namei.c:3428 [inline] path_openat+0x28b4/0x3670 fs/namei.c:3561 do_filp_open+0x277/0x4f0 fs/namei.c:3588 do_sys_openat2+0x13b/0x500 fs/open.c:1200 do_sys_open fs/open.c:1216 [inline] __do_sys_open fs/open.c:1224 [inline] __se_sys_open fs/open.c:1220 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1220 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff8880155fe000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 2437 bytes to the right of 4096-byte region [ffff8880155fe000, ffff8880155ff000) The buggy address belongs to the page: page:ffffea0000557e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x155f8 head:ffffea0000557e00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888011042140 raw: 0000000000000000 0000000000040004 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2966, ts 164725744196, free_ts 164699387645 prep_new_page mm/page_alloc.c:2424 [inline] get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4153 __alloc_pages+0x255/0x580 mm/page_alloc.c:5375 alloc_slab_page mm/slub.c:1763 [inline] allocate_slab+0xcc/0x4d0 mm/slub.c:1900 new_slab mm/slub.c:1963 [inline] ___slab_alloc+0x41e/0xc40 mm/slub.c:2994 __slab_alloc mm/slub.c:3081 [inline] slab_alloc_node mm/slub.c:3172 [inline] slab_alloc mm/slub.c:3214 [inline] __kmalloc+0x2e9/0x370 mm/slub.c:4387 kmalloc include/linux/slab.h:596 [inline] tomoyo_realpath_from_path+0xd8/0x610 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x238/0x660 security/tomoyo/file.c:822 security_inode_getattr+0xc0/0x140 security/security.c:1333 vfs_getattr fs/stat.c:157 [inline] vfs_statx+0x168/0x3f0 fs/stat.c:225 vfs_fstatat fs/stat.c:243 [inline] vfs_lstat include/linux/fs.h:3356 [inline] __do_sys_newlstat fs/stat.c:398 [inline] __se_sys_newlstat+0xba/0x750 fs/stat.c:392 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 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:1338 [inline] free_pcp_prepare+0xc29/0xd20 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3315 [inline] free_unref_page+0x7d/0x580 mm/page_alloc.c:3394 free_slab mm/slub.c:2003 [inline] discard_slab mm/slub.c:2009 [inline] __unfreeze_partials+0x1ab/0x200 mm/slub.c:2495 put_cpu_partial+0x132/0x1a0 mm/slub.c:2575 do_slab_free mm/slub.c:3471 [inline] ___cache_free+0xe6/0x120 mm/slub.c:3490 qlist_free_all mm/kasan/quarantine.c:165 [inline] kasan_quarantine_reduce+0x151/0x1c0 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3214 [inline] kmem_cache_alloc+0x1c3/0x300 mm/slub.c:3219 getname_flags+0xba/0x650 fs/namei.c:138 user_path_at_empty+0x2a/0x1a0 fs/namei.c:2800 user_path_at include/linux/namei.h:57 [inline] vfs_statx+0x10a/0x3f0 fs/stat.c:221 vfs_fstatat fs/stat.c:243 [inline] vfs_lstat include/linux/fs.h:3356 [inline] __do_sys_newlstat fs/stat.c:398 [inline] __se_sys_newlstat+0xba/0x750 fs/stat.c:392 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff8880155ff880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880155ff900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880155ff980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8880155ffa00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880155ffa80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 34 01 xor $0x1,%al 2: 4c 89 44 f9 18 mov %r8,0x18(%rcx,%rdi,8) 7: 49 ff c2 inc %r10 a: 4c 89 11 mov %r10,(%rcx) d: c3 retq e: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) 15: 00 00 00 18: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 1d: 4c 8b 04 24 mov (%rsp),%r8 21: 65 48 8b 14 25 c0 ef mov %gs:0x1efc0,%rdx 28: 01 00 * 2a: 65 8b 05 24 76 7f 7e mov %gs:0x7e7f7624(%rip),%eax # 0x7e7f7655 <-- trapping instruction 31: a9 00 01 ff 00 test $0xff0100,%eax 36: 74 10 je 0x48 38: a9 00 01 00 00 test $0x100,%eax 3d: 74 6e je 0xad 3f: 83 .byte 0x83