KASAN: slab-out-of-bounds Read in __xfrm_decode_session

Status: auto-closed as invalid on 2021/01/07 14:52
Subsystems: net
[Documentation on labels]
First crash: 1697d, last: 1348d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: slab-out-of-bounds Read in __xfrm_decode_session 0 (1) 2019/11/29 08:19
Similar bugs (4)
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 KMSAN: kernel-infoleak in copyout (2) net C 6723 347d 1515d 22/26 fixed on 2023/06/08 14:41
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
linux-6.1 KASAN: use-after-free Read in __xfrm_decode_session 4 239d 371d 0/3 auto-obsoleted due to no activity on 2024/01/01 21:03

Sample crash report:
BUG: KASAN: slab-out-of-bounds in decode_session6 net/xfrm/xfrm_policy.c:3393 [inline]
BUG: KASAN: slab-out-of-bounds in __xfrm_decode_session+0x1b92/0x2710 net/xfrm/xfrm_policy.c:3485
Read of size 1 at addr ffff88809b9ca67b by task syz-executor.5/15179

CPU: 0 PID: 15179 Comm: syz-executor.5 Not tainted 5.9.0-rc4-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+0x1d6/0x29e lib/dump_stack.c:118
 print_address_description+0x66/0x620 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report+0x132/0x1d0 mm/kasan/report.c:530
 decode_session6 net/xfrm/xfrm_policy.c:3393 [inline]
 __xfrm_decode_session+0x1b92/0x2710 net/xfrm/xfrm_policy.c:3485
 xfrm_decode_session_reverse include/net/xfrm.h:1144 [inline]
 icmpv6_route_lookup net/ipv6/icmp.c:388 [inline]
 icmp6_send+0x1d6a/0x28d0 net/ipv6/icmp.c:588
 icmpv6_send include/linux/icmpv6.h:24 [inline]
 ip6_link_failure+0x33/0x460 net/ipv6/route.c:2669
 dst_link_failure include/net/dst.h:426 [inline]
 ipip6_tunnel_xmit net/ipv6/sit.c:1042 [inline]
 sit_tunnel_xmit+0xca9/0x2ae0 net/ipv6/sit.c:1079
 __netdev_start_xmit include/linux/netdevice.h:4634 [inline]
 netdev_start_xmit include/linux/netdevice.h:4648 [inline]
 xmit_one net/core/dev.c:3561 [inline]
 dev_hard_start_xmit+0x1bd/0x3d0 net/core/dev.c:3577
 sch_direct_xmit+0x1f0/0xd40 net/sched/sch_generic.c:313
 qdisc_restart net/sched/sch_generic.c:376 [inline]
 __qdisc_run+0x9ed/0x19f0 net/sched/sch_generic.c:384
 __dev_xmit_skb net/core/dev.c:3800 [inline]
 __dev_queue_xmit+0x141b/0x2940 net/core/dev.c:4105
 neigh_output include/net/neighbour.h:509 [inline]
 ip6_finish_output2+0x106e/0x13f0 net/ipv6/ip6_output.c:117
 dst_output include/net/dst.h:443 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip6_xmit+0xdd9/0x1760 net/ipv6/ip6_output.c:280
 sctp_v6_xmit+0x436/0x5d0 net/sctp/ipv6.c:217
 sctp_packet_transmit+0x22ba/0x2b60 net/sctp/output.c:629
 sctp_packet_singleton net/sctp/outqueue.c:773 [inline]
 sctp_outq_flush_ctrl net/sctp/outqueue.c:904 [inline]
 sctp_outq_flush+0x633/0x32f0 net/sctp/outqueue.c:1186
 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1801 [inline]
 sctp_side_effects net/sctp/sm_sideeffect.c:1185 [inline]
 sctp_do_sm+0x51e7/0x55a0 net/sctp/sm_sideeffect.c:1156
 sctp_primitive_ASSOCIATE+0x90/0xc0 net/sctp/primitive.c:73
 sctp_sendmsg_to_asoc+0x7e4/0x1510 net/sctp/socket.c:1823
 sctp_sendmsg+0x1db7/0x3620 net/sctp/socket.c:2013
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg net/socket.c:671 [inline]
 ____sys_sendmsg+0x519/0x800 net/socket.c:2353
 ___sys_sendmsg net/socket.c:2407 [inline]
 __sys_sendmsg+0x2b1/0x360 net/socket.c:2440
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
RIP: 0033:0x45d5b9
Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f33cb2f4c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000002ccc0 RCX: 000000000045d5b9
RDX: 0000000000000000 RSI: 00000000200014c0 RDI: 0000000000000003
RBP: 000000000118cf80 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118cf4c
R13: 00007fff20a5cb4f R14: 00007f33cb2f59c0 R15: 000000000118cf4c

Allocated by task 0:
 kasan_save_stack mm/kasan/common.c:48 [inline]
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc+0x100/0x130 mm/kasan/common.c:461
 __do_kmalloc mm/slab.c:3655 [inline]
 __kmalloc+0x205/0x300 mm/slab.c:3664
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc+0x1d/0x40 include/linux/slab.h:666
 neigh_alloc net/core/neighbour.c:399 [inline]
 ___neigh_create+0x54c/0x1c50 net/core/neighbour.c:577
 ip6_finish_output2+0x95b/0x13f0 net/ipv6/ip6_output.c:114
 dst_output include/net/dst.h:443 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ndisc_send_skb+0x92d/0xd20 net/ipv6/ndisc.c:506
 addrconf_rs_timer+0x226/0x680 net/ipv6/addrconf.c:3873
 call_timer_fn+0x91/0x160 kernel/time/timer.c:1413
 expire_timers kernel/time/timer.c:1458 [inline]
 __run_timers+0x65e/0x830 kernel/time/timer.c:1755
 run_timer_softirq+0x46/0x80 kernel/time/timer.c:1768
 __do_softirq+0x256/0x6d5 kernel/softirq.c:298

The buggy address belongs to the object at ffff88809b9ca000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 635 bytes to the right of
 1024-byte region [ffff88809b9ca000, ffff88809b9ca400)
The buggy address belongs to the page:
page:0000000011e2575d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9b9ca
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00026d3348 ffffea0001396dc8 ffff8880aa440700
raw: 0000000000000000 ffff88809b9ca000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809b9ca500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809b9ca580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809b9ca600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809b9ca680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809b9ca700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

Crashes (20):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/09/09 14:51 upstream 34d4ddd359db 0ea7a887 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/19 04:50 upstream 642b151f45dd 684d3606 .config console log report ci-upstream-kasan-gce
2019/12/03 01:03 upstream 596cf45cbf6e ab342da3 .config console log report ci-upstream-kasan-gce-selinux-root
2019/10/04 13:36 upstream cc3a7bfe62b9 b2f369e5 .config console log report ci-upstream-kasan-gce
2019/09/26 21:42 upstream cbafe18c7102 2f1548bc .config console log report ci-upstream-kasan-gce
2020/03/10 12:46 upstream 30bb5572ce7a 35f53e45 .config console log report ci-upstream-kasan-gce-386
2020/06/17 22:04 net-old 4d3da2d8d91f b9f3810b .config console log report ci-upstream-net-this-kasan-gce
2020/06/13 17:52 net-old 4d3da2d8d91f dbce178a .config console log report ci-upstream-net-this-kasan-gce
2020/05/14 08:58 net-old 99addbe31f55 a885920d .config console log report ci-upstream-net-this-kasan-gce
2020/01/25 19:29 net-old 61b1f2aff411 2e95ab33 .config console log report ci-upstream-net-this-kasan-gce
2020/01/16 09:27 net-old 8b792f84c637 f9b69507 .config console log report ci-upstream-net-this-kasan-gce
2020/06/07 20:22 net-next-old cb8e59cc8720 2c2b926c .config console log report ci-upstream-net-kasan-gce
2020/05/18 00:45 net-next-old dbfe7d74376e 37bccd4e .config console log report ci-upstream-net-kasan-gce
2020/05/12 07:18 net-next-old 9b1b31d5d4ac 9eb09c40 .config console log report ci-upstream-net-kasan-gce
2020/05/10 07:10 net-next-old 02a5043b22ed 8742a2b9 .config console log report ci-upstream-net-kasan-gce
2020/05/09 10:55 net-next-old 3712c1c2ef2a e97b06d3 .config console log report ci-upstream-net-kasan-gce
2020/02/23 04:09 net-next-old 732a0dee501f 2c36e7a7 .config console log report ci-upstream-net-kasan-gce
2020/01/14 23:37 net-next-old 76ccf5288c62 fa12bd3c .config console log report ci-upstream-net-kasan-gce
2020/05/13 10:48 linux-next ac935d227366 9a6d42fb .config console log report ci-upstream-linux-next-kasan-gce-root
2019/10/21 02:57 linux-next c4b9850b3676 8c88c9c1 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.