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

7 views
Skip to first unread message

syzbot

unread,
Jun 21, 2019, 9:46:07 AM6/21/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 9f31eb60 Linux 4.19.53
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10adaa6ea00000
kernel config: https://syzkaller.appspot.com/x/.config?x=7a36b9832db62b25
dashboard link: https://syzkaller.appspot.com/bug?extid=67463b0de04ce7586b24
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17aec806a00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1006abc6a00000

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

RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000005 R08: 0000000100000300 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402000
R13: 0000000000402090 R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:348 [inline]
BUG: KASAN: slab-out-of-bounds in memcpy_dir crypto/scatterwalk.c:28
[inline]
BUG: KASAN: slab-out-of-bounds in scatterwalk_copychunks+0x269/0x6a0
crypto/scatterwalk.c:43
Read of size 4094 at addr ffff8880915da000 by task syz-executor780/7867

CPU: 0 PID: 7867 Comm: syz-executor780 Not tainted 4.19.53+ #25
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+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d 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+0x8c/0x2ba mm/kasan/report.c:396
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
memcpy+0x24/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:348 [inline]
memcpy_dir crypto/scatterwalk.c:28 [inline]
scatterwalk_copychunks+0x269/0x6a0 crypto/scatterwalk.c:43
scatterwalk_map_and_copy crypto/scatterwalk.c:72 [inline]
scatterwalk_map_and_copy+0x14d/0x1d0 crypto/scatterwalk.c:60
gcmaes_encrypt.constprop.0+0x762/0xd90
arch/x86/crypto/aesni-intel_glue.c:956
generic_gcmaes_encrypt+0x108/0x159 arch/x86/crypto/aesni-intel_glue.c:1297
crypto_aead_encrypt include/crypto/aead.h:335 [inline]
gcmaes_wrapper_encrypt+0x15f/0x200 arch/x86/crypto/aesni-intel_glue.c:1130
crypto_aead_encrypt include/crypto/aead.h:335 [inline]
tls_do_encryption net/tls/tls_sw.c:193 [inline]
tls_push_record+0x9c0/0x13a0 net/tls/tls_sw.c:228
tls_sw_sendpage+0x540/0xd40 net/tls/tls_sw.c:583
inet_sendpage+0x168/0x630 net/ipv4/af_inet.c:815
kernel_sendpage+0x92/0xf0 net/socket.c:3377
sock_sendpage+0x8b/0xc0 net/socket.c:847
pipe_to_sendpage+0x296/0x360 fs/splice.c:452
splice_from_pipe_feed fs/splice.c:503 [inline]
__splice_from_pipe+0x391/0x7d0 fs/splice.c:627
splice_from_pipe+0x108/0x170 fs/splice.c:662
generic_splice_sendpage+0x3c/0x50 fs/splice.c:833
do_splice_from fs/splice.c:852 [inline]
do_splice+0x642/0x12c0 fs/splice.c:1148
__do_sys_splice fs/splice.c:1415 [inline]
__se_sys_splice fs/splice.c:1395 [inline]
__x64_sys_splice+0x2c6/0x330 fs/splice.c:1395
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440719
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 5b 14 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffece804408 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00007ffece804420 RCX: 0000000000440719
RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000005 R08: 0000000100000300 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402000
R13: 0000000000402090 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6780:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc+0x12e/0x700 mm/slab.c:3559
getname_flags fs/namei.c:140 [inline]
getname_flags+0xd6/0x5b0 fs/namei.c:129
getname+0x1a/0x20 fs/namei.c:211
do_sys_open+0x2c9/0x550 fs/open.c:1063
__do_sys_open fs/open.c:1087 [inline]
__se_sys_open fs/open.c:1082 [inline]
__x64_sys_open+0x7e/0xc0 fs/open.c:1082
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6780:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x86/0x260 mm/slab.c:3765
putname+0xef/0x130 fs/namei.c:261
do_sys_open+0x318/0x550 fs/open.c:1078
__do_sys_open fs/open.c:1087 [inline]
__se_sys_open fs/open.c:1082 [inline]
__x64_sys_open+0x7e/0xc0 fs/open.c:1082
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880915daa00
which belongs to the cache names_cache of size 4096
The buggy address is located 2560 bytes to the left of
4096-byte region [ffff8880915daa00, ffff8880915dba00)
The buggy address belongs to the page:
page:ffffea0002457680 count:1 mapcount:0 mapping:ffff88821bc45b00 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffffea00023b7388 ffffea0002457808 ffff88821bc45b00
raw: 0000000000000000 ffff8880915daa00 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880915d9f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880915d9f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff8880915da000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8880915da080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880915da100: fc fc fc fc fc fc fc fc fc fc fc fc 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 can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages