syzbot


WARNING: refcount bug in memfd_secret

Status: closed as dup on 2021/10/25 06:37
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+75639e6a0331cd61d3e2@syzkaller.appspotmail.com
Fix commit: 87066fdd2e30 Revert "mm/secretmem: use refcount_t instead of atomic_t"
First crash: 1113d, last: 1111d
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
  
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
WARNING: refcount bug in sys_memfd_secret mm C done done 4217 1111d 1114d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] WARNING: refcount bug in memfd_secret 4 (5) 2021/10/25 17:00

Sample crash report:
------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 1 PID: 6519 at lib/refcount.c:25 refcount_warn_saturate+0x13d/0x1a0 lib/refcount.c:25
Modules linked in:
CPU: 1 PID: 6519 Comm: syz-executor570 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+0x13d/0x1a0 lib/refcount.c:25
Code: c7 80 e1 b3 8a 31 c0 e8 31 8e 3b fd 0f 0b eb a3 e8 b8 79 71 fd c6 05 43 86 b6 09 01 48 c7 c7 e0 e1 b3 8a 31 c0 e8 13 8e 3b fd <0f> 0b eb 85 e8 9a 79 71 fd c6 05 26 86 b6 09 01 48 c7 c7 40 e2 b3
RSP: 0018:ffffc900014dfed0 EFLAGS: 00010246
RAX: f1edd9615e736100 RBX: 0000000000000002 RCX: ffff88801a6f1c80
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: 0000000000000002 R08: ffffffff81695fe2 R09: ffffed10173a57a8
R10: ffffed10173a57a8 R11: 0000000000000000 R12: ffff8880258c9900
R13: ffff888071dbedc0 R14: 0000000000000003 R15: dffffc0000000000
FS:  0000555556b16300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0a2b914330 CR3: 0000000073408000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __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+0x2ea/0x350 mm/secretmem.c:194
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f0a2b902f89
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:00007fff8e742228 EFLAGS: 00000246 ORIG_RAX: 00000000000001bf
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f0a2b902f89
RDX: 00007f0a2b8c5e93 RSI: 0000000000000012 RDI: 0000000000080000
RBP: 00007f0a2b8c6f70 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007f0a2b8c7000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Crashes (851):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/10/23 18:29 upstream 9c0c4d24ac00 282f03fb .config console log report syz C ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/23 13:38 upstream 9c0c4d24ac00 282f03fb .config console log report syz C ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/25 03:28 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/25 03:16 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/25 02:06 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/25 00:39 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 23:36 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 22:56 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 22:30 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 22:01 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 21:38 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 21:19 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 21:00 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 21:00 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 19:41 upstream 6c62666d8879 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 16:56 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 16:01 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 15:40 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 14:33 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 14:30 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 13:27 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 12:26 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 11:36 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 10:49 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 09:51 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 09:10 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 08:19 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 08:18 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 07:17 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 06:38 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 05:57 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 05:11 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 04:26 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 03:42 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 03:42 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 02:41 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 02:09 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 01:40 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 00:56 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 00:04 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/24 00:03 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/23 23:02 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/23 22:01 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/23 21:23 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
2021/10/23 10:34 upstream 9c0c4d24ac00 282f03fb .config console log report info ci-upstream-kasan-gce-smack-root WARNING: refcount bug in memfd_secret
* Struck through repros no longer work on HEAD.