syzbot


KASAN: use-after-free Read in crypto_chacha20_crypt

Status: closed as dup on 2017/11/29 08:57
Subsystems: crypto
[Documentation on labels]
Reported-by: syzbot+257f413f0ea433750ffaa72b2748289380957904@syzkaller.appspotmail.com
First crash: 2588d, last: 2560d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
general protection fault in crypto_chacha20_crypt crypto C 2374 2553d 2584d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __le32_to_cpup include/uapi/linux/byteorder/little_endian.h:58 [inline]
BUG: KASAN: use-after-free in le32_to_cpuvp crypto/chacha20_generic.c:19 [inline]
BUG: KASAN: use-after-free in crypto_chacha20_init crypto/chacha20_generic.c:58 [inline]
BUG: KASAN: use-after-free in crypto_chacha20_crypt+0xaf1/0xbd0 crypto/chacha20_generic.c:91
Read of size 4 at addr ffff880100000006 by task syzkaller392542/8351

CPU: 1 PID: 8351 Comm: syzkaller392542 Not tainted 4.15.0-rc4+ #229
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+0x194/0x257 lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
 __le32_to_cpup include/uapi/linux/byteorder/little_endian.h:58 [inline]
 le32_to_cpuvp crypto/chacha20_generic.c:19 [inline]
 crypto_chacha20_init crypto/chacha20_generic.c:58 [inline]
 crypto_chacha20_crypt+0xaf1/0xbd0 crypto/chacha20_generic.c:91
 chacha20_simd+0xe4/0x410 arch/x86/crypto/chacha20_glue.c:78
 crypto_skcipher_decrypt include/crypto/skcipher.h:463 [inline]
 _skcipher_recvmsg crypto/algif_skcipher.c:144 [inline]
 skcipher_recvmsg+0xa4e/0xf10 crypto/algif_skcipher.c:165
 sock_recvmsg_nosec net/socket.c:809 [inline]
 sock_recvmsg+0xc9/0x110 net/socket.c:816
 sock_read_iter+0x35b/0x560 net/socket.c:893
 call_read_iter include/linux/fs.h:1766 [inline]
 do_iter_readv_writev+0x5fb/0x7f0 fs/read_write.c:651
 do_iter_read+0x21a/0x5a0 fs/read_write.c:895
 vfs_readv+0x121/0x1c0 fs/read_write.c:959
 do_readv+0xfc/0x2a0 fs/read_write.c:992
 SYSC_readv fs/read_write.c:1079 [inline]
 SyS_readv+0x27/0x30 fs/read_write.c:1076
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x44abf9
RSP: 002b:00007fcd6800ddc8 EFLAGS: 00000202 ORIG_RAX: 0000000000000013
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000044abf9
RDX: 0000000000000005 RSI: 0000000020b3a000 RDI: 000000000000008f
RBP: 0000000000000000 R08: 00007fcd6800e700 R09: 00007fcd6800e700
R10: 00007fcd6800e700 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffe76d6b40f R14: 00007fcd6800e9c0 R15: 0000000000000000

The buggy address belongs to the page:
page:000000005d51089a count:0 mapcount:-127 mapping:          (null) index:0x0
flags: 0x2fffc0000000000()
raw: 02fffc0000000000 0000000000000000 0000000000000000 00000000ffffff80
raw: ffff88021fffae20 ffffea0004010020 000000000000000a 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
BUG: unable to handle kernel paging request at ffffed001fffffe0
IP: memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:53
PGD 21ffd6067 P4D 21ffd6067 PUD 21ffd5067 PMD 0 
Oops: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 8351 Comm: syzkaller392542 Not tainted 4.15.0-rc4+ #229
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:53
RSP: 0018:ffff8801be94f408 EFLAGS: 00010092
RAX: ffff8801be94f414 RBX: ffffed001fffffe0 RCX: 0000000000000010
RDX: 0000000000000010 RSI: ffffed001fffffe0 RDI: ffff8801be94f414
RBP: ffff8801be94f460 R08: ffffed0037d29e87 R09: ffffed0037d29e87
R10: dffffc0000000000 R11: ffffed0037d29e86 R12: 00000000fffffffe
R13: ffff8800ffffff00 R14: ffffed0020000000 R15: 0000000000000014
FS:  00007fcd6800e700(0000) GS:ffff8801db500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffed001fffffe0 CR3: 00000001d025c004 CR4: 00000000001606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 kasan_report_error mm/kasan/report.c:353 [inline]
 kasan_report+0x26f/0x340 mm/kasan/report.c:409
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
 __le32_to_cpup include/uapi/linux/byteorder/little_endian.h:58 [inline]
 le32_to_cpuvp crypto/chacha20_generic.c:19 [inline]
 crypto_chacha20_init crypto/chacha20_generic.c:58 [inline]
 crypto_chacha20_crypt+0xaf1/0xbd0 crypto/chacha20_generic.c:91
 chacha20_simd+0xe4/0x410 arch/x86/crypto/chacha20_glue.c:78
 crypto_skcipher_decrypt include/crypto/skcipher.h:463 [inline]
 _skcipher_recvmsg crypto/algif_skcipher.c:144 [inline]
 skcipher_recvmsg+0xa4e/0xf10 crypto/algif_skcipher.c:165
 sock_recvmsg_nosec net/socket.c:809 [inline]
 sock_recvmsg+0xc9/0x110 net/socket.c:816
 sock_read_iter+0x35b/0x560 net/socket.c:893
 call_read_iter include/linux/fs.h:1766 [inline]
 do_iter_readv_writev+0x5fb/0x7f0 fs/read_write.c:651
 do_iter_read+0x21a/0x5a0 fs/read_write.c:895
 vfs_readv+0x121/0x1c0 fs/read_write.c:959
 do_readv+0xfc/0x2a0 fs/read_write.c:992
 SYSC_readv fs/read_write.c:1079 [inline]
 SyS_readv+0x27/0x30 fs/read_write.c:1076
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x44abf9
RSP: 002b:00007fcd6800ddc8 EFLAGS: 00000202 ORIG_RAX: 0000000000000013
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000044abf9
RDX: 0000000000000005 RSI: 0000000020b3a000 RDI: 000000000000008f
RBP: 0000000000000000 R08: 00007fcd6800e700 R09: 00007fcd6800e700
R10: 00007fcd6800e700 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffe76d6b40f R14: 00007fcd6800e9c0 R15: 0000000000000000
Code: 90 90 90 90 90 eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 
RIP: memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:53 RSP: ffff8801be94f408
CR2: ffffed001fffffe0
---[ end trace 13660e7c8dcc7b1a ]---

Crashes (81):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/12/20 12:30 upstream 10a7e9d84915 2d836b1d .config console log report syz C ci-upstream-kasan-gce
2017/12/18 17:05 upstream 1291a0d5049d 1c4160ef .config console log report syz C ci-upstream-kasan-gce
2017/12/12 11:24 upstream a638349bf6c2 da131727 .config console log report syz C ci-upstream-kasan-gce
2017/12/20 10:58 net-next-old f39a5c01c3d2 2d836b1d .config console log report syz C ci-upstream-net-kasan-gce
2017/11/24 17:46 mmots 1ea8d039f9ed deb5f6ae .config console log report syz C ci-upstream-mmots-kasan-gce
2017/11/24 17:16 linux-next 6fc478f80f68 4bd70f88 .config console log report syz C ci-upstream-next-kasan-gce
2017/12/19 16:32 upstream ace52288edf0 af9163c7 .config console log report ci-upstream-kasan-gce
2017/12/18 16:38 upstream 1291a0d5049d 1c4160ef .config console log report ci-upstream-kasan-gce
2017/12/17 05:08 upstream f3b5ad89de16 b6f0c91b .config console log report ci-upstream-kasan-gce
2017/12/23 08:39 net-next-old fba961ab29e5 73aba437 .config console log report ci-upstream-net-kasan-gce
2017/12/20 09:34 net-next-old f39a5c01c3d2 2d836b1d .config console log report ci-upstream-net-kasan-gce
2017/12/20 02:11 net-next-old f39a5c01c3d2 2d836b1d .config console log report ci-upstream-net-kasan-gce
2017/12/19 08:59 net-next-old 962b582785b6 1c4160ef .config console log report ci-upstream-net-kasan-gce
2017/12/19 07:09 net-next-old e7655085973b 1c4160ef .config console log report ci-upstream-net-kasan-gce
2017/12/19 04:21 net-next-old e7655085973b 1c4160ef .config console log report ci-upstream-net-kasan-gce
2017/12/18 13:36 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/18 09:35 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/18 08:42 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/18 03:55 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/18 03:49 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/18 03:05 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/18 01:43 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 23:31 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 22:27 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 21:19 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 20:41 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 14:11 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 14:02 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 12:27 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 11:05 net-next-old c30abd5e40dd d5beb42a .config console log report ci-upstream-net-kasan-gce
2017/12/17 09:34 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 09:23 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 09:01 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 08:27 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 08:18 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 08:06 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 07:58 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 07:00 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/17 06:37 net-next-old c30abd5e40dd b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/16 15:00 net-next-old 28dc4c8f4557 b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/16 13:18 net-next-old 28dc4c8f4557 b6f0c91b .config console log report ci-upstream-net-kasan-gce
2017/12/16 03:12 net-next-old 3b07d7884ca2 ac20b98c .config console log report ci-upstream-net-kasan-gce
2017/12/15 12:36 net-next-old 5c13e07580c8 ac20b98c .config console log report ci-upstream-net-kasan-gce
2017/12/15 10:57 net-next-old 5c13e07580c8 ac20b98c .config console log report ci-upstream-net-kasan-gce
2017/12/14 23:47 net-next-old 5c13e07580c8 ac20b98c .config console log report ci-upstream-net-kasan-gce
2017/12/14 10:57 net-next-old 5c13e07580c8 ac20b98c .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.