VFS: Close: file count is zero (use-after-free)
From: cheung wall
Date: Sun Mar 17 2024 - 07:57:53 EST
Hello,
when using Healer to fuzz the latest Linux Kernel, the following crash
was triggered on:
HEAD commit: e8f897f4afef0031fe618a8e94127a0934896aba (tag: v6.8)
git tree: upstream
console output: https://pastebin.com/raw/nWDbVZij
kernel config: https://pastebin.com/raw/4m4ax5gq
C reproducer: https://pastebin.com/raw/0ZSaae7K
Syzlang reproducer: https://pastebin.com/raw/RbiX9xe6
If you fix this issue, please add the following tag to the commit:
Reported-by: Qiang Zhang <zzqq0103.hey@xxxxxxxxx>
----------------------------------------------------------
VFS: Close: file count is 0 (f_op=0x23b70e000000000)
BUG: unable to handle page fault for address: ffff88810a878000
WARNING: CPU: 1 PID: 1 at fs/open.c:1507 filp_flush+0x16f/0x1c0 fs/open.c:1507
hrtimer: interrupt took 15451 ns
#PF: supervisor read access in kernel mode
#PF: error_code(0x0009) - reserved bit violation
PGD ae201067 P4D ae201067 PUD 100316063 PMD 10a877063
BAD
Oops: 0009 [#1] PREEMPT SMP KASAN NOPTI
CPU: 2 PID: 307 Comm: syz-executor861 Not tainted 6.8.0 #1
Modules linked in:
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:memmove+0x1e/0x1b0 arch/x86/lib/memmove_64.S:44
CPU: 1 PID: 1 Comm: systemd Not tainted 6.8.0 #1
Code: 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 89 f8 48 39
fe 7d 0f 49 89 f0 49 01 d0 49 39 f8 0f 8f b5 00 00 00 48 89 d1 <f3> a4
e9 d6 84 1a 00 66 2e 0f 1f 84 00 00 00 00 00 48 81 fa a8 02
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RSP: 0018:ffff8881049bf828 EFLAGS: 00010216
RIP: 0010:filp_flush+0x16f/0x1c0 fs/open.c:1507
RAX: ffff88810a40f03c RBX: ffff88810a40f000 RCX: ffffffffffb9700c
Code: b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 75
59 48 8b b5 b0 00 00 00 48 c7 c7 00 a9 30 a1 e8 b2 76 9e ff 90 <0f> 0b
90 90 e8 c8 67 ce ff 45 31 ed 5b 5d 44 89 e8 41 5c 41 5d e9
RDX: ffffffffffffffc4 RSI: ffff88810a878000 RDI: ffff88810a877ff4
RSP: 0018:ffff888100227f00 EFLAGS: 00010282
RBP: ffff88810a40f002 R08: 0000000000000000 R09: fffff9400081772e
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff9df67582
RDX: ffff888100218000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: ffff88810a686000 R08: 0000000000000001 R09: ffffed10235e5121
R10: 0000000000000000 R11: 000000002d2d2d2d R12: ffff8881001dc000
R13: ffff88810a686018 R14: 0000000000000000 R15: 0000000000000000
FS: 00007f0c74a8d900(0000) GS:ffff88811af00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055e6578bda78 CR3: 0000000100f18006 CR4: 0000000000770ef0
PKRU: 55555554
Call Trace:
<TASK>
__do_sys_close fs/open.c:1548 [inline]
__se_sys_close fs/open.c:1539 [inline]
__x64_sys_close+0x81/0x120 fs/open.c:1539
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xb3/0x1b0 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7f0c75257c2b
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c
24 0c e8 a3 4d f9 ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d
00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 e1 4d f9 ff 8b 44
RSP: 002b:00007ffd7894ebb0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 00007f0c74a8d6c8 RCX: 00007f0c75257c2b
RDX: 00007f0c7533abe0 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000004 R08: 0000000000000000 R09: 00007f0c7533abe0
R10: 0000000000001000 R11: 0000000000000293 R12: 0000000000000000
R13: 00007ffd7894ee40 R14: 0000000000000004 R15: 0000557f4bad8bb0
</TASK>