================================================================== 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 ffff88807e5d6999 by task syz-executor.4/9548 CPU: 0 PID: 9548 Comm: syz-executor.4 Not tainted 5.15.0-rc6-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 vti6_tnl_xmit+0x436/0x1c10 __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:console_trylock_spinning+0x377/0x3f0 kernel/printk/printk.c:1885 Code: 0f 84 75 ff ff ff e8 b8 65 1a 00 fb 31 db eb 41 e8 ae 65 1a 00 e8 79 36 91 08 4d 85 ed 74 cd e8 9f 65 1a 00 fb bb 01 00 00 00 <48> c7 c7 80 8f 7f 8c 31 f6 ba 01 00 00 00 31 c9 41 b8 01 00 00 00 RSP: 0018:ffffc9000383f860 EFLAGS: 00000287 RAX: ffffffff81693021 RBX: 0000000000000001 RCX: 0000000000040000 RDX: ffffc900126ae000 RSI: 000000000002f886 RDI: 000000000002f887 RBP: ffffc9000383f930 R08: ffffffff81692fda R09: fffffbfff1fa37fe R10: fffffbfff1fa37fe R11: 0000000000000000 R12: 1ffff92000707f0c R13: 0000000000000200 R14: 0000000000000046 R15: dffffc0000000000 vprintk_emit+0xa1/0x140 kernel/printk/printk.c:2243 _printk+0xcf/0x118 kernel/printk/printk.c:2265 input_register_device+0xb20/0x1140 drivers/input/input.c:2323 uinput_create_device drivers/input/misc/uinput.c:364 [inline] uinput_ioctl_handler+0x1a33/0x2bc0 drivers/input/misc/uinput.c:870 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:860 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 RIP: 0033:0x7fd71899ea39 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fd715f14188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fd718aa1f60 RCX: 00007fd71899ea39 RDX: 0000000000000000 RSI: 0000000000005501 RDI: 0000000000000003 RBP: 00007fd7189f8e8f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc8010c30f R14: 00007fd715f14300 R15: 0000000000022000 Allocated by task 4501: 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_slab_alloc+0xb2/0xe0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3213 [inline] slab_alloc mm/slub.c:3221 [inline] kmem_cache_alloc+0x1c3/0x300 mm/slub.c:3226 shmem_alloc_inode+0x16/0x30 mm/shmem.c:3738 alloc_inode fs/inode.c:237 [inline] new_inode_pseudo+0x61/0x220 fs/inode.c:938 new_inode+0x25/0x1d0 fs/inode.c:967 shmem_get_inode+0x116/0x750 mm/shmem.c:2288 shmem_mknod+0x54/0x1b0 mm/shmem.c:2827 lookup_open fs/namei.c:3282 [inline] open_last_lookups fs/namei.c:3352 [inline] path_openat+0x1397/0x3670 fs/namei.c:3558 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 ffff88807e5d6380 which belongs to the cache shmem_inode_cache of size 1464 The buggy address is located 97 bytes to the right of 1464-byte region [ffff88807e5d6380, ffff88807e5d6938) The buggy address belongs to the page: page:ffffea0001f97400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7e5d0 head:ffffea0001f97400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888140007dc0 raw: 0000000000000000 0000000000140014 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 4500, ts 40223837313, free_ts 40083422486 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:1770 [inline] allocate_slab+0xcc/0x4d0 mm/slub.c:1907 new_slab mm/slub.c:1970 [inline] ___slab_alloc+0x41e/0xc40 mm/slub.c:3001 __slab_alloc mm/slub.c:3088 [inline] slab_alloc_node mm/slub.c:3179 [inline] slab_alloc mm/slub.c:3221 [inline] kmem_cache_alloc+0x274/0x300 mm/slub.c:3226 shmem_alloc_inode+0x16/0x30 mm/shmem.c:3738 alloc_inode fs/inode.c:237 [inline] new_inode_pseudo+0x61/0x220 fs/inode.c:938 new_inode+0x25/0x1d0 fs/inode.c:967 shmem_get_inode+0x116/0x750 mm/shmem.c:2288 shmem_mknod+0x54/0x1b0 mm/shmem.c:2827 lookup_open fs/namei.c:3282 [inline] open_last_lookups fs/namei.c:3352 [inline] path_openat+0x1397/0x3670 fs/namei.c:3558 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 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:2010 [inline] discard_slab mm/slub.c:2016 [inline] __unfreeze_partials+0x1ab/0x200 mm/slub.c:2502 put_cpu_partial+0x132/0x1a0 mm/slub.c:2582 do_slab_free mm/slub.c:3480 [inline] ___cache_free+0xe6/0x120 mm/slub.c:3499 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:3213 [inline] slab_alloc mm/slub.c:3221 [inline] __kmalloc+0x1e7/0x370 mm/slub.c:4396 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 Memory state around the buggy address: ffff88807e5d6880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88807e5d6900: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc >ffff88807e5d6980: fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 ^ ffff88807e5d6a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88807e5d6a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: 0f 84 75 ff ff ff je 0xffffff7b 6: e8 b8 65 1a 00 callq 0x1a65c3 b: fb sti c: 31 db xor %ebx,%ebx e: eb 41 jmp 0x51 10: e8 ae 65 1a 00 callq 0x1a65c3 15: e8 79 36 91 08 callq 0x8913693 1a: 4d 85 ed test %r13,%r13 1d: 74 cd je 0xffffffec 1f: e8 9f 65 1a 00 callq 0x1a65c3 24: fb sti 25: bb 01 00 00 00 mov $0x1,%ebx * 2a: 48 c7 c7 80 8f 7f 8c mov $0xffffffff8c7f8f80,%rdi <-- trapping instruction 31: 31 f6 xor %esi,%esi 33: ba 01 00 00 00 mov $0x1,%edx 38: 31 c9 xor %ecx,%ecx 3a: 41 b8 01 00 00 00 mov $0x1,%r8d