syzbot


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

Status: closed as dup on 2017/11/30 09:01
Subsystems: crypto
[Documentation on labels]
Reported-by: syzbot+f574f3c1cda02a64178d8a137bc83881e246ac9c@syzkaller.appspotmail.com
First crash: 2587d, last: 2564d
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: slab-out-of-bounds in __le32_to_cpup include/uapi/linux/byteorder/little_endian.h:58 [inline]
BUG: KASAN: slab-out-of-bounds in le32_to_cpuvp crypto/chacha20_generic.c:19 [inline]
BUG: KASAN: slab-out-of-bounds in crypto_chacha20_init crypto/chacha20_generic.c:58 [inline]
BUG: KASAN: slab-out-of-bounds in crypto_chacha20_crypt+0xaf1/0xbd0 crypto/chacha20_generic.c:91
Read of size 4 at addr ffff880100000006 by task syz-executor1/15417

CPU: 1 PID: 15417 Comm: syz-executor1 Not tainted 4.14.0+ #129
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:133 [inline]
 skcipher_recvmsg+0xb06/0xf30 crypto/algif_skcipher.c:164
 skcipher_recvmsg_nokey+0x60/0x80 crypto/algif_skcipher.c:283
 sock_recvmsg_nosec net/socket.c:805 [inline]
 sock_recvmsg+0xc9/0x110 net/socket.c:812
 ___sys_recvmsg+0x29b/0x630 net/socket.c:2207
 __sys_recvmsg+0xe2/0x210 net/socket.c:2252
 SYSC_recvmsg net/socket.c:2264 [inline]
 SyS_recvmsg+0x2d/0x50 net/socket.c:2259
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x452879
RSP: 002b:00007f56842e0be8 EFLAGS: 00000212 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 0000000000452879
RDX: 0000000040010101 RSI: 000000002008dfc8 RDI: 0000000000000014
RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f2608
R13: 00000000ffffffff R14: 00007f56842e16d4 R15: 0000000000000000

Allocated by task 11435:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3547
 sock_alloc_inode+0x70/0x300 net/socket.c:250
 alloc_inode+0x65/0x180 fs/inode.c:208
 new_inode_pseudo+0x69/0x190 fs/inode.c:890
 sock_alloc+0x41/0x270 net/socket.c:565
 __sock_create+0x148/0x850 net/socket.c:1225
 sock_create_kern+0x3f/0x50 net/socket.c:1307
 inet_ctl_sock_create+0xa0/0x200 net/ipv4/af_inet.c:1536
 icmpv6_sk_init+0x132/0x500 net/ipv6/icmp.c:963
 ops_init+0x10a/0x570 net/core/net_namespace.c:118
 setup_net+0x319/0x720 net/core/net_namespace.c:295
 copy_net_ns+0x27c/0x580 net/core/net_namespace.c:419
 create_new_namespaces+0x425/0x880 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xae/0x1e0 kernel/nsproxy.c:206
 SYSC_unshare kernel/fork.c:2366 [inline]
 SyS_unshare+0x653/0xfa0 kernel/fork.c:2316
 entry_SYSCALL_64_fastpath+0x1f/0x96

Freed by task 3387:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3491 [inline]
 kmem_cache_free+0x77/0x280 mm/slab.c:3749
 sock_destroy_inode+0x56/0x70 net/socket.c:280
 destroy_inode+0x15d/0x200 fs/inode.c:265
 evict+0x57e/0x920 fs/inode.c:570
 iput_final fs/inode.c:1515 [inline]
 iput+0x7b9/0xaf0 fs/inode.c:1542
 sock_release+0x168/0x1e0 net/socket.c:606
 inet_ctl_sock_destroy include/net/inet_common.h:52 [inline]
 icmpv6_sk_exit+0xe4/0x170 net/ipv6/icmp.c:992
 ops_exit_list.isra.6+0xae/0x150 net/core/net_namespace.c:142
 cleanup_net+0x5c7/0xb60 net/core/net_namespace.c:484
 process_one_work+0xbfd/0x1be0 kernel/workqueue.c:2112
 worker_thread+0x223/0x1990 kernel/workqueue.c:2246
 kthread+0x37a/0x440 kernel/kthread.c:238
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:437

The buggy address belongs to the object at ffff880100000040
 which belongs to the cache sock_inode_cache of size 1048
The buggy address is located 58 bytes to the left of
 1048-byte region [ffff880100000040, ffff880100000458)
The buggy address belongs to the page:
page:ffffea0004000000 count:1 mapcount:0 mapping:ffff880100000040 index:0xffff880100000ffd
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff880100000040 ffff880100000ffd 0000000100000003
raw: ffffea00070f5160 ffffea00070f4d20 ffff8801d9d32b40 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: 15417 Comm: syz-executor1 Not tainted 4.14.0+ #129
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff8801c49ba400 task.stack: ffff8801d1ca0000
RIP: 0010:memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:53
RSP: 0018:ffff8801d1ca74f8 EFLAGS: 00010096
RAX: ffff8801d1ca7504 RBX: ffffed001fffffe0 RCX: 0000000000000010
RDX: 0000000000000010 RSI: ffffed001fffffe0 RDI: ffff8801d1ca7504
RBP: ffff8801d1ca7550 R08: ffffed003a394ea5 R09: ffffed003a394ea5
R10: dffffc0000000000 R11: ffffed003a394ea4 R12: 00000000fffffffe
R13: ffff8800ffffff00 R14: ffffed0020000000 R15: 0000000000000014
FS:  00007f56842e1700(0000) GS:ffff8801db500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffed001fffffe0 CR3: 00000001c86ee000 CR4: 00000000001406e0
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:133 [inline]
 skcipher_recvmsg+0xb06/0xf30 crypto/algif_skcipher.c:164
 skcipher_recvmsg_nokey+0x60/0x80 crypto/algif_skcipher.c:283
 sock_recvmsg_nosec net/socket.c:805 [inline]
 sock_recvmsg+0xc9/0x110 net/socket.c:812
 ___sys_recvmsg+0x29b/0x630 net/socket.c:2207
 __sys_recvmsg+0xe2/0x210 net/socket.c:2252
 SYSC_recvmsg net/socket.c:2264 [inline]
 SyS_recvmsg+0x2d/0x50 net/socket.c:2259
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x452879
RSP: 002b:00007f56842e0be8 EFLAGS: 00000212 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 0000000000452879
RDX: 0000000040010101 RSI: 000000002008dfc8 RDI: 0000000000000014
RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f2608
R13: 00000000ffffffff R14: 00007f56842e16d4 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: ffff8801d1ca74f8
CR2: ffffed001fffffe0
---[ end trace cff17c735fe850c1 ]---

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/11/26 00:35 net-next-old 1d3b78bbc6e9 deb5f6ae .config console log report ci-upstream-kasan-gce-386
2017/12/19 05:20 net-next-old e7655085973b 1c4160ef .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.