syzbot


WARNING: refcount bug in sys_memfd_secret
Status: fixed on 2022/03/08 16:11
Reported-by: syzbot+b904a1de3ec43711eba5@syzkaller.appspotmail.com
Fix commit: 87066fdd2e30 Revert "mm/secretmem: use refcount_t instead of atomic_t"
First crash: 217d, last: 214d

Cause bisection: introduced by (bisect log) :
commit 110860541f443f950c1274f217a1a3e298670a33
Author: Jordy Zomer <jordy@jordyzomer.github.io>
Date: Wed Sep 8 02:56:18 2021 +0000

  mm/secretmem: use refcount_t instead of atomic_t

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

Fix bisection: fixed by (bisect log) :
commit 87066fdd2e30fe9dd531125d95257c118a74617e
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun Oct 24 19:48:33 2021 +0000

  Revert "mm/secretmem: use refcount_t instead of atomic_t"

duplicates (2):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
WARNING: refcount bug in secretmem_release 1 216d 216d 0/22 closed as dup on 2021/10/25 06:38
WARNING: refcount bug in memfd_secret C done 851 214d 216d 22/22 closed as dup on 2021/10/25 06:37
Patch testing requests:
Created Duration User Patch Repo Result
2021/10/23 13:34 10m fmdefrancesco@gmail.com patch upstream report log

Sample crash report:
------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 0 PID: 6540 at lib/refcount.c:25 refcount_warn_saturate+0x169/0x1e0 lib/refcount.c:25
Modules linked in:
CPU: 0 PID: 6540 Comm: syz-executor161 Not tainted 5.15.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:refcount_warn_saturate+0x169/0x1e0 lib/refcount.c:25
Code: 09 31 ff 89 de e8 87 b4 9b fd 84 db 0f 85 36 ff ff ff e8 ca ac 9b fd 48 c7 c7 c0 65 e3 89 c6 05 ff 56 7f 09 01 e8 0d 45 19 05 <0f> 0b e9 17 ff ff ff e8 ab ac 9b fd 0f b6 1d e4 56 7f 09 31 ff 89
RSP: 0018:ffffc9000c7a7f10 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff888073be0300 RSI: ffffffff815dcf58 RDI: fffff520018f4fd4
RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff815d6cce R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
FS:  0000555556a3f300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1bacc3b6c0 CR3: 00000000214ae000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __refcount_add include/linux/refcount.h:199 [inline]
 __refcount_inc include/linux/refcount.h:250 [inline]
 refcount_inc include/linux/refcount.h:267 [inline]
 __do_sys_memfd_secret mm/secretmem.c:221 [inline]
 __se_sys_memfd_secret mm/secretmem.c:194 [inline]
 __x64_sys_memfd_secret+0x182/0x1e0 mm/secretmem.c:194
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fc28a0a4f79
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd689c4668 EFLAGS: 00000246 ORIG_RAX: 00000000000001bf
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc28a0a4f79
RDX: 00007fc28a067e83 RSI: 0000000000000012 RDI: 0000000000000000
RBP: 00007fc28a068f60 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007fc28a068ff0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Crashes (4217):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2021/10/23 13:01 upstream 9c0c4d24ac00 282f03fb .config log report syz C WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/23 13:00 upstream 9c0c4d24ac00 282f03fb .config log report syz C WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/23 12:40 upstream 9c0c4d24ac00 282f03fb .config log report syz C WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/23 12:23 linux-next cf6c9d12750c 282f03fb .config log report syz C WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/23 12:01 linux-next cf6c9d12750c 282f03fb .config log report syz C WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/25 02:51 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/25 02:39 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/25 02:32 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/25 02:23 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-qemu-upstream 2021/10/25 01:40 upstream 6c62666d8879 4f0000ee .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/24 23:25 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 23:14 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 23:08 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 22:56 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 22:48 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 22:42 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 22:35 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 22:29 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/24 22:24 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 22:17 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 22:11 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 22:04 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/24 21:57 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 21:40 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 21:34 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 21:17 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 21:09 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-selinux-root 2021/10/24 21:01 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 20:53 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/24 20:45 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce 2021/10/24 20:33 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 20:08 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-root 2021/10/24 19:53 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-qemu-upstream 2021/10/22 14:39 upstream 64222515138e 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-qemu-upstream-386 2021/10/25 09:03 upstream 6c62666d8879 4f0000ee .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-386 2021/10/25 03:15 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-386 2021/10/24 23:44 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-386 2021/10/24 23:02 upstream 6c62666d8879 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-kasan-gce-386 2021/10/24 17:38 upstream 9c0c4d24ac00 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 08:50 linux-next cf6c9d12750c 4f0000ee .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 08:20 linux-next cf6c9d12750c 4f0000ee .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 07:13 linux-next cf6c9d12750c 4f0000ee .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 06:23 linux-next cf6c9d12750c 4f0000ee .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 06:22 linux-next cf6c9d12750c 4f0000ee .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 01:11 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 00:42 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/25 00:19 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/24 21:47 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/24 21:25 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/24 20:21 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/24 19:40 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/24 19:25 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/24 19:24 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret
ci-upstream-linux-next-kasan-gce-root 2021/10/24 18:24 linux-next cf6c9d12750c 282f03fb .config log report info WARNING: refcount bug in sys_memfd_secret