KASAN: use-after-free Read in _decode_session6

24 views
Skip to first unread message

syzbot

unread,
May 15, 2020, 9:18:14 AM5/15/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: ab9dfda2 Linux 4.14.180
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12507152100000
kernel config: https://syzkaller.appspot.com/x/.config?x=221566a7407ce2de
dashboard link: https://syzkaller.appspot.com/bug?extid=c86525c19cda18dd8c5a
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+c86525...@syzkaller.appspotmail.com

x86/PAT: syz-executor.4:12986 map pfn RAM range req write-combining for [mem 0x1e2800000-0x1e2802fff], got write-back
==================================================================
BUG: KASAN: use-after-free in _decode_session6+0xd2d/0x13d0 net/ipv6/xfrm6_policy.c:136
Read of size 1 at addr ffff88809fbe7812 by task syz-executor.5/12991

CPU: 1 PID: 12991 Comm: syz-executor.5 Not tainted 4.14.180-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x13e/0x194 lib/dump_stack.c:58
x86/PAT: syz-executor.4:12994 map pfn RAM range req write-combining for [mem 0x1e0700000-0x1e0702fff], got write-back
print_address_description.cold+0x7c/0x1e2 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2ae mm/kasan/report.c:393
_decode_session6+0xd2d/0x13d0 net/ipv6/xfrm6_policy.c:136
__xfrm_decode_session+0x5a/0x110 net/xfrm/xfrm_policy.c:2247
xfrm_decode_session include/net/xfrm.h:1174 [inline]
vti_tunnel_xmit+0x135/0x16c0 net/ipv4/ip_vti.c:327
__netdev_start_xmit include/linux/netdevice.h:4039 [inline]
netdev_start_xmit include/linux/netdevice.h:4048 [inline]
xmit_one net/core/dev.c:3009 [inline]
dev_hard_start_xmit+0x186/0x890 net/core/dev.c:3025
sch_direct_xmit+0x25f/0x510 net/sched/sch_generic.c:186
qdisc_restart net/sched/sch_generic.c:249 [inline]
__qdisc_run+0x1b6/0xde0 net/sched/sch_generic.c:257
__dev_xmit_skb net/core/dev.c:3235 [inline]
__dev_queue_xmit+0x1573/0x25c0 net/core/dev.c:3493
neigh_output include/net/neighbour.h:500 [inline]
ip6_finish_output2+0x992/0x2150 net/ipv6/ip6_output.c:120
ip6_finish_output+0x4d9/0xaf0 net/ipv6/ip6_output.c:154
NF_HOOK_COND include/linux/netfilter.h:239 [inline]
ip6_output+0x1c9/0x650 net/ipv6/ip6_output.c:171
dst_output include/net/dst.h:462 [inline]
ip6_local_out+0x93/0x170 net/ipv6/output_core.c:178
ip6_send_skb+0x9b/0x2f0 net/ipv6/ip6_output.c:1688
udp_v6_send_skb+0x4f3/0xf20 net/ipv6/udp.c:1081
udpv6_sendmsg+0x1eb9/0x2610 net/ipv6/udp.c:1353
inet_sendmsg+0x116/0x4d0 net/ipv4/af_inet.c:762
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xc5/0x100 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c829
RSP: 002b:00007f8e6e013c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00000000004fc3a0 RCX: 000000000045c829
RDX: 00000000000001b1 RSI: 00000000200010c0 RDI: 0000000000000006
RBP: 000000000078c0e0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000008df R14: 00000000004cb835 R15: 00007f8e6e0146d4

Allocated by task 6840:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15b/0x7c0 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
sock_kmalloc net/core/sock.c:1982 [inline]
sock_kmalloc+0x75/0xc0 net/core/sock.c:1973
hash_alloc_result.part.0+0x94/0x110 crypto/algif_hash.c:46
hash_alloc_result crypto/algif_hash.c:65 [inline]
hash_recvmsg+0x50e/0x880 crypto/algif_hash.c:206
___sys_recvmsg+0x21f/0x4d0 net/socket.c:2221
__sys_recvmmsg+0x1f3/0x620 net/socket.c:2329
SYSC_recvmmsg net/socket.c:2405 [inline]
SyS_recvmmsg+0x125/0x140 net/socket.c:2394
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 6840:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
__sock_kfree_s net/core/sock.c:2001 [inline]
sock_kzfree_s+0x24/0x50 net/core/sock.c:2015
hash_free_result crypto/algif_hash.c:64 [inline]
hash_recvmsg+0x3c8/0x880 crypto/algif_hash.c:231
___sys_recvmsg+0x21f/0x4d0 net/socket.c:2221
__sys_recvmmsg+0x1f3/0x620 net/socket.c:2329
SYSC_recvmmsg net/socket.c:2405 [inline]
SyS_recvmmsg+0x125/0x140 net/socket.c:2394
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88809fbe7800
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 18 bytes inside of
32-byte region [ffff88809fbe7800, ffff88809fbe7820)
The buggy address belongs to the page:
page:ffffea00027ef9c0 count:1 mapcount:0 mapping:ffff88809fbe7000 index:0xffff88809fbe7fc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88809fbe7000 ffff88809fbe7fc1 0000000100000028
raw: ffffea0002a10c60 ffffea000241b4a0 ffff88812fe541c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809fbe7700: 05 fc fc fc fc fc fc fc 00 01 fc fc fc fc fc fc
ffff88809fbe7780: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
>ffff88809fbe7800: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
^
ffff88809fbe7880: fb fb fb fb fc fc fc fc 05 fc fc fc fc fc fc fc
ffff88809fbe7900: 00 00 00 00 fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
May 23, 2020, 11:16:16 AM5/23/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 1bab61d3 Linux 4.19.124
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10723f06100000
kernel config: https://syzkaller.appspot.com/x/.config?x=e95e3ce854b90b1b
dashboard link: https://syzkaller.appspot.com/bug?extid=03e56119629ed37d93a6
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+03e561...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in _decode_session6+0xeb6/0x1300 net/ipv6/xfrm6_policy.c:137
Read of size 1 at addr ffff8880750fe4a9 by task syz-executor.1/3697

CPU: 0 PID: 3697 Comm: syz-executor.1 Not tainted 4.19.124-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/0x222 mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x88/0x2b9 mm/kasan/report.c:396
_decode_session6+0xeb6/0x1300 net/ipv6/xfrm6_policy.c:137
__xfrm_decode_session+0x5a/0x130 net/xfrm/xfrm_policy.c:2304
xfrm_decode_session_reverse include/net/xfrm.h:1244 [inline]
icmpv6_route_lookup+0x2f5/0x470 net/ipv6/icmp.c:372
icmp6_send+0x1460/0x2260 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+0x1453/0x2625 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+0x1a4/0x940 net/core/dev.c:3276
sch_direct_xmit+0x343/0xfd0 net/sched/sch_generic.c:332
qdisc_restart net/sched/sch_generic.c:395 [inline]
__qdisc_run+0x4d3/0x1690 net/sched/sch_generic.c:403
__dev_xmit_skb net/core/dev.c:3504 [inline]
__dev_queue_xmit+0x182a/0x3010 net/core/dev.c:3814
neigh_output include/net/neighbour.h:501 [inline]
ip6_finish_output2+0x130c/0x2570 net/ipv6/ip6_output.c:120
ip6_finish_output+0x7e8/0xc00 net/ipv6/ip6_output.c:154
NF_HOOK_COND include/linux/netfilter.h:278 [inline]
ip6_output+0x205/0x760 net/ipv6/ip6_output.c:171
dst_output include/net/dst.h:447 [inline]
ip6_local_out+0xaf/0x170 net/ipv6/output_core.c:178
ip6_send_skb+0xb3/0x300 net/ipv6/ip6_output.c:1699
ip6_push_pending_frames+0xbd/0xe0 net/ipv6/ip6_output.c:1719
rawv6_push_pending_frames net/ipv6/raw.c:618 [inline]
rawv6_sendmsg+0x2a3b/0x3670 net/ipv6/raw.c:959
inet_sendmsg+0x12e/0x590 net/ipv4/af_inet.c:798
sock_sendmsg_nosec net/socket.c:622 [inline]
sock_sendmsg+0xc3/0x120 net/socket.c:632
__sys_sendto+0x21a/0x330 net/socket.c:1787
__do_sys_sendto net/socket.c:1799 [inline]
__se_sys_sendto net/socket.c:1795 [inline]
__x64_sys_sendto+0xdd/0x1b0 net/socket.c:1795
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45ca29
Code: 0d b7 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 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f69c6d3bc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000000501200 RCX: 000000000045ca29
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 000000000078bf00 R08: 0000000020000180 R09: 000000000000001c
R10: 0000000000000004 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000a0f R14: 00000000004cce62 R15: 00007f69c6d3c6d4

The buggy address belongs to the page:
page:ffffea0001d43f80 count:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000000()
raw: 00fffe0000000000 ffffea000212d088 ffffea0002800008 0000000000000000
raw: 0000000000000000 ffff88806871bc60 00000001fffffbff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880750fe380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880750fe400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880750fe480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff8880750fe500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880750fe580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

syzbot

unread,
Sep 21, 2020, 3:45:10 AM9/21/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Oct 22, 2020, 1:34:10 PM10/22/20
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages