syzbot


KASAN: use-after-free Read in __xfrm_decode_session

Status: auto-obsoleted due to no activity on 2024/01/01 21:03
Reported-by: syzbot+6590bc11902aa1260078@syzkaller.appspotmail.com
First crash: 370d, last: 239d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in __xfrm_decode_session (2) net 7 896d 1133d 0/26 auto-closed as invalid on 2022/04/04 17:22
upstream KASAN: use-after-free Read in __xfrm_decode_session net 12 1353d 1711d 0/26 auto-closed as invalid on 2021/01/03 02:25
linux-5.15 KASAN: slab-out-of-bounds Read in __xfrm_decode_session origin:upstream C error 7 193d 380d 0/3 auto-obsoleted due to no activity on 2024/02/16 23:16
upstream KMSAN: kernel-infoleak in copyout (2) net C 6723 347d 1515d 22/26 fixed on 2023/06/08 14:41
upstream KMSAN: kernel-infoleak in _copy_to_iter (7) net C 138977 450d 802d 22/26 fixed on 2023/02/24 13:50
upstream KMSAN: uninit-value in __xfrm_decode_session (4) net C 8 210d 257d 0/26 closed as invalid on 2023/12/14 11:46
upstream KASAN: slab-out-of-bounds Read in __xfrm_decode_session net 20 1348d 1633d 0/26 auto-closed as invalid on 2021/01/07 14:52

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in decode_session6 net/xfrm/xfrm_policy.c:3383 [inline]
BUG: KASAN: use-after-free in __xfrm_decode_session+0x19de/0x23e0 net/xfrm/xfrm_policy.c:3489
Read of size 1 at addr ffff88808065dc3b by task syz-executor.3/22067

CPU: 1 PID: 22067 Comm: syz-executor.3 Not tainted 6.1.40-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 decode_session6 net/xfrm/xfrm_policy.c:3383 [inline]
 __xfrm_decode_session+0x19de/0x23e0 net/xfrm/xfrm_policy.c:3489
 xfrm_decode_session_reverse include/net/xfrm.h:1176 [inline]
 icmpv6_route_lookup+0x44a/0x680 net/ipv6/icmp.c:386
 icmp6_send+0x1258/0x20e0 net/ipv6/icmp.c:593
 __icmpv6_send include/linux/icmpv6.h:28 [inline]
 icmpv6_send include/linux/icmpv6.h:49 [inline]
 ip6_link_failure+0x37/0x4a0 net/ipv6/route.c:2786
 dst_link_failure include/net/dst.h:423 [inline]
 ip6_tnl_xmit+0x1055/0x28c0 net/ipv6/ip6_tunnel.c:1269
 ipxip6_tnl_xmit net/ipv6/ip6_tunnel.c:1385 [inline]
 ip6_tnl_start_xmit+0xbd7/0x1460 net/ipv6/ip6_tunnel.c:1434
 __netdev_start_xmit include/linux/netdevice.h:4853 [inline]
 netdev_start_xmit include/linux/netdevice.h:4867 [inline]
 xmit_one net/core/dev.c:3595 [inline]
 dev_hard_start_xmit+0x261/0x8c0 net/core/dev.c:3611
 sch_direct_xmit+0x2b2/0x5e0 net/sched/sch_generic.c:342
 qdisc_restart net/sched/sch_generic.c:407 [inline]
 __qdisc_run+0xa7a/0x1fb0 net/sched/sch_generic.c:415
 __dev_xmit_skb net/core/dev.c:3885 [inline]
 __dev_queue_xmit+0x1126/0x3c90 net/core/dev.c:4227
 neigh_output include/net/neighbour.h:544 [inline]
 ip6_finish_output2+0xf9f/0x15b0 net/ipv6/ip6_output.c:134
 __ip6_finish_output net/ipv6/ip6_output.c:195 [inline]
 ip6_finish_output+0x6ac/0xa80 net/ipv6/ip6_output.c:206
 ip6_send_skb+0x12b/0x240 net/ipv6/ip6_output.c:1989
 rawv6_push_pending_frames+0x7a4/0xa00 net/ipv6/raw.c:580
 rawv6_sendmsg+0x1754/0x2150 net/ipv6/raw.c:924
 sock_sendmsg_nosec net/socket.c:716 [inline]
 sock_sendmsg net/socket.c:736 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2482
 ___sys_sendmsg net/socket.c:2536 [inline]
 __sys_sendmmsg+0x3ab/0x730 net/socket.c:2622
 __do_sys_sendmmsg net/socket.c:2651 [inline]
 __se_sys_sendmmsg net/socket.c:2648 [inline]
 __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2648
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f6d5d67cb29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6d5e3b20c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f6d5d79bf80 RCX: 00007f6d5d67cb29
RDX: 0000000000000001 RSI: 0000000020007c40 RDI: 0000000000000003
RBP: 00007f6d5d6c847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f6d5d79bf80 R15: 00007ffd94a81018
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0002019740 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x8065d
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001f74c48 ffffea0001f1bb48 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffff7f 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x500dc0(GFP_USER|__GFP_ZERO|__GFP_ACCOUNT), pid 3577, tgid 3577 (syz-executor.0), ts 1394147340905, free_ts 1394223991964
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 __pte_alloc_one include/asm-generic/pgalloc.h:63 [inline]
 pte_alloc_one+0x86/0x360 arch/x86/mm/pgtable.c:33
 __pte_alloc+0x75/0x220 mm/memory.c:468
 copy_pte_range mm/memory.c:1032 [inline]
 copy_pmd_range mm/memory.c:1167 [inline]
 copy_pud_range mm/memory.c:1204 [inline]
 copy_p4d_range mm/memory.c:1228 [inline]
 copy_page_range+0x3d7e/0x4580 mm/memory.c:1326
 dup_mmap kernel/fork.c:696 [inline]
 dup_mm+0xddf/0x1610 kernel/fork.c:1532
 copy_mm+0xca/0x160 kernel/fork.c:1581
 copy_process+0x19a2/0x4020 kernel/fork.c:2259
 kernel_clone+0x222/0x920 kernel/fork.c:2679
 __do_sys_clone kernel/fork.c:2820 [inline]
 __se_sys_clone kernel/fork.c:2804 [inline]
 __x64_sys_clone+0x231/0x280 kernel/fork.c:2804
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1460 [inline]
 free_pcp_prepare mm/page_alloc.c:1510 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
 free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530
 release_pages+0x2836/0x2b40 mm/swap.c:1055
 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
 tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
 tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
 exit_mmap+0x3c3/0x9f0 mm/mmap.c:3226
 __mmput+0x115/0x3c0 kernel/fork.c:1191
 exit_mm+0x226/0x300 kernel/exit.c:563
 do_exit+0x67e/0x2300 kernel/exit.c:856
 do_group_exit+0x202/0x2b0 kernel/exit.c:1019
 get_signal+0x16f7/0x17d0 kernel/signal.c:2858
 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:869
 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86

Memory state around the buggy address:
 ffff88808065db00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88808065db80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88808065dc00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                        ^
 ffff88808065dc80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88808065dd00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/07/23 19:34 linux-6.1.y 75389113731b 27cbe77f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in __xfrm_decode_session
2023/05/15 10:12 linux-6.1.y bf4ad6fa4e53 c4d362e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in __xfrm_decode_session
2023/09/23 21:02 linux-6.1.y d23900f974e0 0b6a67ac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Read in __xfrm_decode_session
2023/08/04 23:27 linux-6.1.y 52a953d0934b cdae481e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Read in __xfrm_decode_session
* Struck through repros no longer work on HEAD.