KASAN: slab-out-of-bounds Write in sha3_update

3 views
Skip to first unread message

syzbot

unread,
Nov 28, 2017, 3:45:05 PM11/28/17
to da...@davemloft.net, her...@gondor.apana.org.au, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzkaller hit the following crash on
4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.

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


QAT: Invalid ioctl
QAT: Invalid ioctl
QAT: Invalid ioctl
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:341 [inline]
BUG: KASAN: slab-out-of-bounds in sha3_update+0xdf/0x2e0
crypto/sha3_generic.c:161
Write of size 192 at addr ffff8801bf3f80fc by task syz-executor3/18788

CPU: 1 PID: 18788 Comm: syz-executor3 Not tainted 4.15.0-rc1+ #197
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
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x137/0x190 mm/kasan/kasan.c:267
memcpy+0x37/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:341 [inline]
sha3_update+0xdf/0x2e0 crypto/sha3_generic.c:161
crypto_shash_update+0xcb/0x220 crypto/shash.c:109
hmac_update+0x7e/0xa0 crypto/hmac.c:122
crypto_shash_update+0xcb/0x220 crypto/shash.c:109
kdf_ctr security/keys/dh.c:181 [inline]
keyctl_dh_compute_kdf security/keys/dh.c:226 [inline]
__keyctl_dh_compute+0x16d8/0x1a00 security/keys/dh.c:398
keyctl_dh_compute+0xac/0xf3 security/keys/dh.c:434
SYSC_keyctl security/keys/keyctl.c:1745 [inline]
SyS_keyctl+0x72/0x2c0 security/keys/keyctl.c:1641
entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x4529d9
RSP: 002b:00007fe38be94c58 EFLAGS: 00000212 ORIG_RAX: 00000000000000fa
RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 00000000004529d9
RDX: 000000002030bfff RSI: 0000000020e17000 RDI: 0000000000000017
RBP: 000000000000036f R08: 0000000020cfe000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000212 R12: 00000000006f2308
R13: 00000000ffffffff R14: 00007fe38be956d4 R15: 0000000000000000

Allocated by task 18788:
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
__do_kmalloc mm/slab.c:3711 [inline]
__kmalloc+0x162/0x760 mm/slab.c:3720
kmalloc include/linux/slab.h:504 [inline]
kdf_alloc security/keys/dh.c:111 [inline]
__keyctl_dh_compute+0x2a1/0x1a00 security/keys/dh.c:288
keyctl_dh_compute+0xac/0xf3 security/keys/dh.c:434
SYSC_keyctl security/keys/keyctl.c:1745 [inline]
SyS_keyctl+0x72/0x2c0 security/keys/keyctl.c:1641
entry_SYSCALL_64_fastpath+0x1f/0x96

Freed by task 15953:
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]
kfree+0xca/0x250 mm/slab.c:3806
load_elf_binary+0x1e0c/0x4c50 fs/binfmt_elf.c:1106
search_binary_handler+0x142/0x6b0 fs/exec.c:1634
exec_binprm fs/exec.c:1676 [inline]
do_execveat_common.isra.30+0x1754/0x23c0 fs/exec.c:1798
do_execve+0x31/0x40 fs/exec.c:1843
call_usermodehelper_exec_async+0x457/0x8f0 kernel/umh.c:100
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:441

The buggy address belongs to the object at ffff8801bf3f8000
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 252 bytes inside of
512-byte region [ffff8801bf3f8000, ffff8801bf3f8200)
The buggy address belongs to the page:
page:ffffea0006fcfe00 count:1 mapcount:0 mapping:ffff8801bf3f8000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801bf3f8000 0000000000000000 0000000100000006
raw: ffffea0007346be0 ffffea00063a1620 ffff8801db000940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801bf3f8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8801bf3f8100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff8801bf3f8180: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8801bf3f8200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801bf3f8280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.
Please credit me with: Reported-by: syzbot <syzk...@googlegroups.com>

syzbot will keep track of this bug report.
Once a fix for this bug is committed, please reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug
report.
Note: all commands must start from beginning of the line in the email body.
config.txt
raw.log

Eric Biggers

unread,
Nov 28, 2017, 4:35:53 PM11/28/17
to syzbot, da...@davemloft.net, her...@gondor.apana.org.au, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
#syz dup: KASAN: stack-out-of-bounds Write in sha3_update
Reply all
Reply to author
Forward
0 new messages