KASAN: stack-out-of-bounds Read in xfrm_state_find

28 views
Skip to first unread message

syzbot

unread,
Apr 10, 2019, 8:00:21 PM4/10/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 47350a9f ANDROID: x86_64_cuttlefish_defconfig: Enable lz4 ..
git tree: android-4.14
console output: https://syzkaller.appspot.com/x/log.txt?x=1010cc46400000
kernel config: https://syzkaller.appspot.com/x/.config?x=10d236078f3378a3
dashboard link: https://syzkaller.appspot.com/bug?extid=a98ad023c84d44183880
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12689ffe400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11a0b15a400000

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

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
urandom_read: 1 callbacks suppressed
random: sshd: uninitialized urandom read (32 bytes read)
==================================================================
BUG: KASAN: stack-out-of-bounds in __xfrm6_daddr_saddr_hash
net/xfrm/xfrm_hash.h:29 [inline]
BUG: KASAN: stack-out-of-bounds in __xfrm_dst_hash net/xfrm/xfrm_hash.h:96
[inline]
BUG: KASAN: stack-out-of-bounds in xfrm_dst_hash net/xfrm/xfrm_state.c:60
[inline]
BUG: KASAN: stack-out-of-bounds in xfrm_state_find+0x2594/0x2650
net/xfrm/xfrm_state.c:953
Read of size 4 at addr ffff8801c2cff680 by task syz-executor103/1970

CPU: 1 PID: 1970 Comm: syz-executor103 Not tainted 4.14.67+ #1
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0xb9/0x11b lib/dump_stack.c:53
print_address_description+0x60/0x22b mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409
__xfrm6_daddr_saddr_hash net/xfrm/xfrm_hash.h:29 [inline]
__xfrm_dst_hash net/xfrm/xfrm_hash.h:96 [inline]
xfrm_dst_hash net/xfrm/xfrm_state.c:60 [inline]
xfrm_state_find+0x2594/0x2650 net/xfrm/xfrm_state.c:953
xfrm_tmpl_resolve_one+0x1a7/0x750 net/xfrm/xfrm_policy.c:1394
xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:1438 [inline]
xfrm_resolve_and_create_bundle+0x21a/0x24d0 net/xfrm/xfrm_policy.c:1832
xfrm_lookup+0x23b/0x1790 net/xfrm/xfrm_policy.c:2161
xfrm_lookup_route+0x34/0x1a0 net/xfrm/xfrm_policy.c:2281
ip_route_output_flow+0x86/0xa0 net/ipv4/route.c:2563
udp_sendmsg+0x1377/0x1da0 net/ipv4/udp.c:1021
udpv6_sendmsg+0x125f/0x2510 net/ipv6/udp.c:1186
inet_sendmsg+0x168/0x540 net/ipv4/af_inet.c:781
sock_sendmsg_nosec net/socket.c:645 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:655
___sys_sendmsg+0x41d/0x890 net/socket.c:2061
__sys_sendmmsg+0x13d/0x360 net/socket.c:2151
SYSC_sendmmsg net/socket.c:2182 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2177
do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4403f9
RSP: 002b:00007ffc5175f8b8 EFLAGS: 00000217 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004403f9
RDX: 0000000000000001 RSI: 0000000020000a80 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000401c80
R13: 0000000000401d10 R14: 0000000000000000 R15: 0000000000000000

The buggy address belongs to the page:
page:ffffea00070b3fc0 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0x4000000000000000()
raw: 4000000000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: 0000000000000000 ffffea00070b3fe0 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801c2cff580: 00 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2 f2 f2 f2
ffff8801c2cff600: f2 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00
> ffff8801c2cff680: f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 f2 f2
^
ffff8801c2cff700: f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8801c2cff780: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f2
==================================================================


---
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 can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Apr 11, 2019, 8:00:47 PM4/11/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: dfca92ba Merge 4.4.169 into android-4.4
git tree: android-4.4
console output: https://syzkaller.appspot.com/x/log.txt?x=1164bffb400000
kernel config: https://syzkaller.appspot.com/x/.config?x=39bc4256ec37590
dashboard link: https://syzkaller.appspot.com/bug?extid=1c6a4ec6a2709a5528d9
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=162d9880c00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=112f68bb400000

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

==================================================================
BUG: KASAN: stack-out-of-bounds in __xfrm6_daddr_saddr_hash
net/xfrm/xfrm_hash.h:28 [inline]
BUG: KASAN: stack-out-of-bounds in __xfrm_dst_hash net/xfrm/xfrm_hash.h:95
[inline]
BUG: KASAN: stack-out-of-bounds in xfrm_dst_hash net/xfrm/xfrm_state.c:46
[inline]
BUG: KASAN: stack-out-of-bounds in xfrm_state_find+0x23f5/0x24c0
net/xfrm/xfrm_state.c:783
Read of size 4 at addr ffff8801d42a7710 by task syz-executor028/2077

CPU: 0 PID: 2077 Comm: syz-executor028 Not tainted 4.4.169+ #1
0000000000000000 7836bb36766aabdb ffff8801d42a6ed0 ffffffff81aab9c1
0000000000000000 ffffea000750a9c0 ffff8801d42a7710 0000000000000004
0000000000000003 ffff8801d42a6f08 ffffffff8148fc0d 0000000000000000
Call Trace:
[<ffffffff81aab9c1>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81aab9c1>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
[<ffffffff8148fc0d>] print_address_description+0x6f/0x21b
mm/kasan/report.c:252
[<ffffffff8148fe45>] kasan_report_error mm/kasan/report.c:351 [inline]
[<ffffffff8148fe45>] kasan_report mm/kasan/report.c:408 [inline]
[<ffffffff8148fe45>] kasan_report.cold+0x8c/0x2be mm/kasan/report.c:393
[<ffffffff814849d4>] __asan_report_load4_noabort+0x14/0x20
mm/kasan/report.c:428
[<ffffffff825633c5>] __xfrm6_daddr_saddr_hash net/xfrm/xfrm_hash.h:28
[inline]
[<ffffffff825633c5>] __xfrm_dst_hash net/xfrm/xfrm_hash.h:95 [inline]
[<ffffffff825633c5>] xfrm_dst_hash net/xfrm/xfrm_state.c:46 [inline]
[<ffffffff825633c5>] xfrm_state_find+0x23f5/0x24c0
net/xfrm/xfrm_state.c:783
[<ffffffff82549d77>] xfrm_tmpl_resolve_one+0x1c7/0x790
net/xfrm/xfrm_policy.c:1455
[<ffffffff8254a550>] xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:1499 [inline]
[<ffffffff8254a550>] xfrm_resolve_and_create_bundle+0x210/0x1df0
net/xfrm/xfrm_policy.c:1847
[<ffffffff8254d4b3>] xfrm_lookup+0x203/0xad0 net/xfrm/xfrm_policy.c:2204
[<ffffffff8254ec48>] xfrm_lookup_route+0x38/0x140
net/xfrm/xfrm_policy.c:2326
[<ffffffff823a2703>] ip_route_output_flow+0x93/0xa0 net/ipv4/route.c:2437
[<ffffffff8247cda7>] udp_sendmsg+0x1537/0x1c60 net/ipv4/udp.c:1040
[<ffffffff82610002>] udpv6_sendmsg+0x12f2/0x24f0 net/ipv6/udp.c:1173
[<ffffffff824a6112>] inet_sendmsg+0x202/0x4d0 net/ipv4/af_inet.c:755
[<ffffffff821d50de>] sock_sendmsg_nosec net/socket.c:638 [inline]
[<ffffffff821d50de>] sock_sendmsg+0xbe/0x110 net/socket.c:648
[<ffffffff821d6bb9>] ___sys_sendmsg+0x369/0x890 net/socket.c:1975
[<ffffffff821da030>] __sys_sendmmsg+0x130/0x2e0 net/socket.c:2060
[<ffffffff821da215>] SYSC_sendmmsg net/socket.c:2090 [inline]
[<ffffffff821da215>] SyS_sendmmsg+0x35/0x60 net/socket.c:2085
[<ffffffff827153a1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

The buggy address belongs to the page:
page:ffffea000750a9c0 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0x4000000000000000()
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801d42a7600: 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00
ffff8801d42a7680: f2 f2 f2 00 00 00 f2 f2 f2 f2 f2 00 00 00 00 00
> ffff8801d42a7700: 00 00 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00
^
ffff8801d42a7780: f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00
ffff8801d42a7800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Reply all
Reply to author
Forward
0 new messages