syzbot


VFS: Close: file count is zero (use-after-free)

Status: upstream: reported C repro on 2024/06/02 15:20
Subsystems: squashfs
[Documentation on labels]
Reported-by: syzbot+b2cfdac9ae5278d4b621@syzkaller.appspotmail.com
First crash: 13d, last: 5h16m
Cause bisection: introduced by (bisect log) :
commit 344a1d8575b05298d0702a9f9231e57db86a855e
Author: Vivek Kasireddy <vivek.kasireddy@intel.com>
Date: Thu Apr 11 06:59:42 2024 +0000

  udmabuf: convert udmabuf driver to use folios

Crash: VFS: Close: file count is zero (use-after-free) (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH v15 0/9] mm/gup: Introduce memfd_pin_folios() for pinning memfd folios 1 (1) 2024/06/13 21:42
[syzbot] [squashfs?] VFS: Close: file count is zero (use-after-free) 1 (6) 2024/06/13 07:10
Last patch testing requests (4)
Created Duration User Patch Repo Result
2024/06/13 06:23 24m vivek.kasireddy@intel.com https://gitlab.freedesktop.org/Vivek/drm-tip.git syzbot_fixes OK log
2024/06/03 06:19 9m nightu.pwn@gmail.com patch linux-next error OK
2024/06/03 05:51 0m nightu.pwn@gmail.com patch linux-next error OK
2024/06/03 05:42 0m nightu.pwn@gmail.com patch linux-next error OK

Sample crash report:
VFS: Close: file count is 0 (f_op=shmem_file_operations)
------------[ cut here ]------------
kernel BUG at fs/open.c:1514!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 PID: 5089 Comm: syz-executor317 Not tainted 6.10.0-rc1-next-20240531-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
RIP: 0010:filp_flush+0x152/0x160 fs/open.c:1512
Code: e9 80 e1 07 80 c1 03 38 c1 7c a6 48 89 ef e8 c5 03 f0 ff eb 9c e8 6e 16 8a ff 48 c7 c7 20 59 d8 8b 48 89 ee e8 6f 84 7d 09 90 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc900033bfc80 EFLAGS: 00010246
RAX: 0000000000000038 RBX: 0000000000000000 RCX: fe0d96255f7cdc00
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffffffff8bd42dc0 R08: ffffffff8176b129 R09: 1ffff92000677f2c
R10: dffffc0000000000 R11: fffff52000677f2d R12: ffff8880784d9680
R13: dffffc0000000000 R14: ffff88807aa761c0 R15: 0000000000000009
FS:  0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000003f3be538 CR3: 000000007f062000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 filp_close+0x1e/0x40 fs/open.c:1532
 close_files fs/file.c:437 [inline]
 put_files_struct+0x1b6/0x360 fs/file.c:452
 do_exit+0xa08/0x28e0 kernel/exit.c:869
 do_group_exit+0x207/0x2c0 kernel/exit.c:1023
 __do_sys_exit_group kernel/exit.c:1034 [inline]
 __se_sys_exit_group kernel/exit.c:1032 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1032
 x64_sys_call+0x26a8/0x26b0 arch/x86/include/generated/asm/syscalls_64.h:232
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc324e0fd09
Code: Unable to access opcode bytes at 0x7fc324e0fcdf.
RSP: 002b:00007fffe9a711b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc324e0fd09
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 00007fc324e8b2d0 R08: ffffffffffffffb8 R09: 0000555580c204c0
R10: 0000555580c204c0 R11: 0000000000000246 R12: 00007fc324e8b2d0
R13: 0000000000000000 R14: 00007fc324e8c040 R15: 00007fc324dddf00
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:filp_flush+0x152/0x160 fs/open.c:1512
Code: e9 80 e1 07 80 c1 03 38 c1 7c a6 48 89 ef e8 c5 03 f0 ff eb 9c e8 6e 16 8a ff 48 c7 c7 20 59 d8 8b 48 89 ee e8 6f 84 7d 09 90 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc900033bfc80 EFLAGS: 00010246
RAX: 0000000000000038 RBX: 0000000000000000 RCX: fe0d96255f7cdc00
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffffffff8bd42dc0 R08: ffffffff8176b129 R09: 1ffff92000677f2c
R10: dffffc0000000000 R11: fffff52000677f2d R12: ffff8880784d9680
R13: dffffc0000000000 R14: ffff88807aa761c0 R15: 0000000000000009
FS:  0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000003f3be538 CR3: 000000007f062000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/02 03:35 linux-next 0e1980c40b6e 3113787f .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/15 12:57 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/15 12:56 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/14 11:46 linux-next a957267fa7e9 a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/14 11:46 linux-next a957267fa7e9 a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/12 09:45 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/11 21:32 linux-next a957267fa7e9 c7d7d815 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/11 21:32 linux-next a957267fa7e9 c7d7d815 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/10 10:58 linux-next d35b2284e966 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/09 14:36 linux-next d35b2284e966 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/07 10:15 linux-next d35b2284e966 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/02 16:20 linux-next 0e1980c40b6e 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/02 14:30 linux-next 0e1980c40b6e 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/02 14:30 linux-next 0e1980c40b6e 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/02 02:37 linux-next 0e1980c40b6e 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
2024/06/02 02:35 linux-next 0e1980c40b6e 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root VFS: Close: file count is zero (use-after-free)
* Struck through repros no longer work on HEAD.