syzbot


WARNING: refcount bug in crypto_mod_get

Status: fixed on 2020/07/17 17:58
Subsystems: crypto
[Documentation on labels]
Reported-by: syzbot+afb77bdbaca0cda9e991@syzkaller.appspotmail.com
Fix commit: 6603523bf5e4 crypto: api - Fix use-after-free and race in crypto_spawn_alg
First crash: 1686d, last: 1671d
Cause bisection: introduced by (bisect log) :
commit b877ad1a135c802d4529a72aa82faf46ef5db097
Author: Ard Biesheuvel <ardb@kernel.org>
Date: Tue Nov 5 14:01:04 2019 +0000

  crypto: omap-aes-gcm - check length of assocdata in RFC4106 mode

Crash: BUG: corrupted list in crypto_drop_spawn (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
WARNING: refcount bug in crypto_mod_get 1 (2) 2020/06/05 12:38

Sample crash report:
------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 0 PID: 7775 at lib/refcount.c:25 refcount_warn_saturate+0x169/0x1e0 lib/refcount.c:25
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 7775 Comm: syz-executor692 Not tainted 5.7.0-rc3-syzkaller #0
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+0x188/0x20d lib/dump_stack.c:118
 panic+0x2e3/0x75c kernel/panic.c:221
 __warn.cold+0x2f/0x35 kernel/panic.c:582
 report_bug+0x27b/0x2f0 lib/bug.c:195
 fixup_bug arch/x86/kernel/traps.c:175 [inline]
 fixup_bug arch/x86/kernel/traps.c:170 [inline]
 do_error_trap+0x12b/0x220 arch/x86/kernel/traps.c:267
 do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:286
 invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1027
RIP: 0010:refcount_warn_saturate+0x169/0x1e0 lib/refcount.c:25
Code: 06 31 ff 89 de e8 87 b9 dc fd 84 db 0f 85 36 ff ff ff e8 4a b8 dc fd 48 c7 c7 a0 5b 72 88 c6 05 b2 1c ee 06 01 e8 4f f3 ad fd <0f> 0b e9 17 ff ff ff e8 2b b8 dc fd 0f b6 1d 97 1c ee 06 31 ff 89
RSP: 0018:ffffc90002797bf8 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff815ce171 RDI: fffff520004f2f71
RBP: 0000000000000002 R08: ffff88809d9e6400 R09: ffffed1015cc66a9
R10: ffff8880ae633547 R11: ffffed1015cc66a8 R12: ffff8880a403a048
R13: ffff88809df99d00 R14: ffffed1013bf33a5 R15: ffff888099925048
 refcount_add include/linux/refcount.h:204 [inline]
 refcount_inc include/linux/refcount.h:241 [inline]
 crypto_alg_get crypto/internal.h:87 [inline]
 crypto_mod_get+0xc6/0xf0 crypto/api.c:37
 crypto_spawn_alg.isra.0+0xa8/0x110 crypto/algapi.c:723
 crypto_spawn_tfm2+0x19/0xb0 crypto/algapi.c:763
 crypto_spawn_aead include/crypto/internal/aead.h:102 [inline]
 pcrypt_aead_init_tfm+0x144/0x273 crypto/pcrypt.c:182
 crypto_aead_init_tfm+0x138/0x1a0 crypto/aead.c:140
 crypto_create_tfm+0xd5/0x2f0 crypto/api.c:454
 crypto_alloc_tfm+0x100/0x340 crypto/api.c:526
 aead_bind+0x69/0x170 crypto/algif_aead.c:483
 alg_bind+0x260/0x530 crypto/af_alg.c:182
 __sys_bind+0x20e/0x250 net/socket.c:1662
 __do_sys_bind net/socket.c:1673 [inline]
 __se_sys_bind net/socket.c:1671 [inline]
 __x64_sys_bind+0x6f/0xb0 net/socket.c:1671
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x441359
Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 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 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd04b593e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 00000000004a2378 RCX: 0000000000441359
RDX: 0000000000000058 RSI: 0000000020000040 RDI: 0000000000000003
RBP: 000000000000e5c5 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000004 R11: 0000000000000246 R12: 00000000004020d0
R13: 0000000000402160 R14: 0000000000000000 R15: 0000000000000000
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/27 16:54 upstream 6a8b55ed4056 0ce7569e .config console log report syz C ci-upstream-kasan-gce-root
2020/05/13 00:24 upstream 24085f70a6e1 a44eb8f7 .config console log report ci-qemu-upstream
* Struck through repros no longer work on HEAD.