KASAN: use-after-free Read in _decode_session6

Status: auto-closed as invalid on 2020/10/22 17:34
First crash: 1462d, last: 1429d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Read in _decode_session6 23 884d 1539d 0/1 auto-closed as invalid on 2022/04/20 21:31
linux-4.19 KASAN: use-after-free Read in _decode_session6 (2) 1 737d 737d 0/1 auto-obsoleted due to no activity on 2022/09/15 14:44
linux-4.14 KASAN: use-after-free Read in _decode_session6 2 1461d 1470d 0/1 auto-closed as invalid on 2020/09/21 07:45
android-414 KASAN: use-after-free Read in _decode_session6 1 2080d 2080d 0/1 auto-closed as invalid on 2019/03/12 14:41
upstream KASAN: use-after-free Read in _decode_session6 net C done 4 2019d 2087d 13/26 fixed on 2019/11/07 18:45

Sample crash report:
BUG: KASAN: use-after-free in _decode_session6+0xf56/0x1370 net/ipv6/xfrm6_policy.c:137
Read of size 1 at addr ffff888058cf0207 by task syz-executor.1/17934

CPU: 0 PID: 17934 Comm: syz-executor.1 Not tainted 4.19.129-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load1_noabort+0x88/0x90 mm/kasan/report.c:430
 _decode_session6+0xf56/0x1370 net/ipv6/xfrm6_policy.c:137
 __xfrm_decode_session+0x5a/0x130 net/xfrm/xfrm_policy.c:2299
 xfrm_decode_session_reverse include/net/xfrm.h:1244 [inline]
 icmpv6_route_lookup+0x2fb/0x460 net/ipv6/icmp.c:372
 icmp6_send+0x150d/0x2230 net/ipv6/icmp.c:555
 icmpv6_send+0xde/0x210 net/ipv6/ip6_icmp.c:43
 ip6_link_failure+0x26/0x4e0 net/ipv6/route.c:2297
 dst_link_failure include/net/dst.h:430 [inline]
 ipip6_tunnel_xmit net/ipv6/sit.c:1001 [inline]
 sit_tunnel_xmit+0x1967/0x2810 net/ipv6/sit.c:1038
 __netdev_start_xmit include/linux/netdevice.h:4314 [inline]
 netdev_start_xmit include/linux/netdevice.h:4323 [inline]
 xmit_one net/core/dev.c:3260 [inline]
 dev_hard_start_xmit+0x1a8/0x920 net/core/dev.c:3276
 sch_direct_xmit+0x2d6/0xf50 net/sched/sch_generic.c:332
 qdisc_restart net/sched/sch_generic.c:395 [inline]
 __qdisc_run+0x4d0/0x1630 net/sched/sch_generic.c:403
 __dev_xmit_skb net/core/dev.c:3504 [inline]
 __dev_queue_xmit+0x1516/0x2df0 net/core/dev.c:3814
 neigh_output include/net/neighbour.h:501 [inline]
 ip6_finish_output2+0x113d/0x2290 net/ipv6/ip6_output.c:120
 ip6_finish_output+0x7e9/0xc00 net/ipv6/ip6_output.c:154
 NF_HOOK_COND include/linux/netfilter.h:278 [inline]
 ip6_output+0x205/0x770 net/ipv6/ip6_output.c:171
 dst_output include/net/dst.h:447 [inline]
 NF_HOOK include/linux/netfilter.h:289 [inline]
 ip6_xmit+0xdbf/0x20a0 net/ipv6/ip6_output.c:275
 tcp_v6_send_synack+0x547/0x9d0 net/ipv6/tcp_ipv6.c:505
 tcp_conn_request+0x27b4/0x3540 net/ipv4/tcp_input.c:6531
 tcp_v6_conn_request+0x100/0x290 net/ipv6/tcp_ipv6.c:1041
 tcp_rcv_state_process+0xacd/0x4c50 net/ipv4/tcp_input.c:6026
 tcp_v6_do_rcv+0x47c/0x1370 net/ipv6/tcp_ipv6.c:1351
 tcp_v6_rcv+0x366b/0x3990 net/ipv6/tcp_ipv6.c:1545
 ip6_input_finish+0x46a/0x17a0 net/ipv6/ip6_input.c:395
 NF_HOOK include/linux/netfilter.h:289 [inline]
 ip6_input+0xcf/0x3c0 net/ipv6/ip6_input.c:438
 dst_input include/net/dst.h:453 [inline]
 ip6_rcv_finish+0x1d9/0x2f0 net/ipv6/ip6_input.c:76
 NF_HOOK include/linux/netfilter.h:289 [inline]
 ipv6_rcv+0xf2/0x3f0 net/ipv6/ip6_input.c:283
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:4960
 __netif_receive_skb+0x27/0x1c0 net/core/dev.c:5072
 netif_receive_skb_internal+0xf0/0x3f0 net/core/dev.c:5162
 tun_rx_batched.isra.0+0x468/0x730 drivers/net/tun.c:1535
 tun_get_user+0x2952/0x4c30 drivers/net/tun.c:1966
 tun_chr_write_iter+0xb0/0x150 drivers/net/tun.c:1995
 call_write_iter include/linux/fs.h:1821 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x51b/0x770 fs/read_write.c:487
 vfs_write+0x1f3/0x540 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
RIP: 0033:0x416641
Code: 75 14 b8 01 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 c4 1b 00 00 c3 48 83 ec 08 e8 ca fc ff ff 48 89 04 24 b8 01 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 13 fd ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007f6f63f71c60 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000509400 RCX: 0000000000416641
RDX: 000000000000008a RSI: 0000000020000280 RDI: 00000000000000f0
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 00000000ffffffff
R13: 0000000000000bf9 R14: 00000000004ce4f7 R15: 00007f6f63f726d4

The buggy address belongs to the page:
page:ffffea0001633c00 count:0 mapcount:-128 mapping:0000000000000000 index:0xffff888058cf3540
flags: 0xfffe0000000000()
raw: 00fffe0000000000 ffffea000162e408 ffffea00025dfc08 0000000000000000
raw: ffff888058cf3540 0000000000000004 00000000ffffff7f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888058cf0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888058cf0180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888058cf0200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888058cf0280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888058cf0300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/24 17:33 linux-4.19.y b3a99fd385fa 41694dbf .config console log report ci2-linux-4-19
2020/05/23 15:15 linux-4.19.y 1bab61d3e8cd 4afdfa20 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.