syzbot


WARNING: refcount bug in find_key_to_update

Status: upstream: reported syz repro on 2019/10/17 01:42
Reported-by: syzbot+6455648abc28dbdd1e7f@syzkaller.appspotmail.com
First crash: 993d, last: 993d

Cause bisection: introduced by (bisect log) :
commit 0570bc8b7c9b41deba6f61ac218922e7168ad648
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu Jul 18 19:26:59 2019 +0000

  Merge tag 'riscv/for-v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Crash: WARNING: refcount bug in find_key_to_update (log)
Repro: syz .config

Fix bisection: failed (bisect log)
Patch testing requests:
Created Duration User Patch Repo Result
2019/10/22 12:31 16m dhowells@redhat.com git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git 0e5bbd42663f31221c05b1a6025de5bced81ca5f report log
2019/10/22 10:25 17m dhowells@redhat.com git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git 0e5bbd42663f31221c05b1a6025de5bced81ca5f OK
2019/10/22 10:01 17m dhowells@redhat.com git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git 0e5bbd42663f31221c05b1a6025de5bced81ca5f OK
2019/10/22 09:26 16m dhowells@redhat.com git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git 7f002fe7ea3c0005d4a23b311a42cac48c91cad7 report log

Sample crash report:
------------[ cut here ]------------
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 1 PID: 9064 at lib/refcount.c:156 refcount_inc_checked lib/refcount.c:156 [inline]
WARNING: CPU: 1 PID: 9064 at lib/refcount.c:156 refcount_inc_checked+0x61/0x70 lib/refcount.c:154
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 9064 Comm: syz-executor.5 Not tainted 5.4.0-rc3+ #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+0x172/0x1f0 lib/dump_stack.c:113
 panic+0x2e3/0x75c kernel/panic.c:221
 __warn.cold+0x2f/0x35 kernel/panic.c:582
 report_bug+0x289/0x300 lib/bug.c:195
 fixup_bug arch/x86/kernel/traps.c:179 [inline]
 fixup_bug arch/x86/kernel/traps.c:174 [inline]
 do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:272
 do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:291
 invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1028
RIP: 0010:refcount_inc_checked lib/refcount.c:156 [inline]
RIP: 0010:refcount_inc_checked+0x61/0x70 lib/refcount.c:154
Code: 1d 58 46 7e 06 31 ff 89 de e8 0b cb 2e fe 84 db 75 dd e8 c2 c9 2e fe 48 c7 c7 40 ad e6 87 c6 05 38 46 7e 06 01 e8 67 0c 00 fe <0f> 0b eb c1 90 90 90 90 90 90 90 90 90 90 90 55 48 89 e5 41 57 41
RSP: 0018:ffff888081447c68 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff815cb646 RDI: ffffed1010288f7f
RBP: ffff888081447c78 R08: ffff8880a231a080 R09: ffffed1015d26159
R10: ffffed1015d26158 R11: ffff8880ae930ac7 R12: ffff8880a4518940
R13: 0000000000000000 R14: ffff888081447e10 R15: ffff8880a4518c40
 __key_get include/linux/key.h:281 [inline]
 find_key_to_update+0x8b/0xc0 security/keys/keyring.c:1127
 key_create_or_update+0x588/0xbe0 security/keys/key.c:905
 __do_sys_add_key security/keys/keyctl.c:132 [inline]
 __se_sys_add_key security/keys/keyctl.c:72 [inline]
 __x64_sys_add_key+0x2bd/0x4f0 security/keys/keyctl.c:72
 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459a59
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f22e3171c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000f8
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000459a59
RDX: 0000000020000440 RSI: 0000000020000000 RDI: 0000000020000040
RBP: 000000000075bf20 R08: fffffffffffffffe R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000246 R12: 00007f22e31726d4
R13: 00000000004bfab8 R14: 00000000004d1ad8 R15: 00000000ffffffff
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2019/10/16 22:05 upstream bc88f85c6c09 8c88c9c1 .config log report syz