syzbot
WARNING: proc registration bug in ntfs_put_super
Status:
upstream: reported C repro on 2026/11/26 10:13
Subsystems:
ntfs3
Labels:
prio:low
[Documentation on labels]
Reported-by: syzbot+d7aeb9ab7b1cc022914e@syzkaller.appspotmail.com
First crash: 2d21h, last: 2h05m
β¨ AI-generated root cause summary:
In fs/ntfs3/super.c, ntfs_create_procdir() calls proc_mkdir() to create sbi->procdir and then calls proc_create_data() for "volinfo" and "label" without checking whether those calls return NULL (such as on allocation failure in __proc_create()). Because sbi->procdir is still assigned unconditionally, later superblock teardown in ntfs_put_super() -> ntfs_remove_procdir() unconditionally calls remove_proc_entry() for both "label" and "volinfo". When a missing entry is passed to remove_proc_entry(), pde_subdir_find() returns NULL and triggers WARN(1, "name '%s'\n", name) at fs/proc/generic.c:742.
▶
▼
β¨ Full AI root cause analysis
Root Cause Analysis
The bug is located in fs/ntfs3/super.c in ntfs_create_procdir() and ntfs_remove_procdir().
-
Unchecked proc_create_data() return values (fs/ntfs3/super.c:626-641):
During ntfs_fill_super(), ntfs_create_procdir(sb) creates a /proc/fs/ntfs3/<s_id> directory and its child entries:
e = proc_mkdir(sb->s_id, proc_info_root);
if (e) {
struct ntfs_sb_info *sbi = sb->s_fs_info;
proc_create_data("volinfo", 0444, e, &ntfs3_volinfo_fops, sb);
proc_create_data("label", 0644, e, &ntfs3_label_fops, sb);
sbi->procdir = e;
}
When proc_create_data("volinfo", ...) failsβsuch as when kmem_cache_zalloc(proc_dir_entry_cache, GFP_KERNEL) fails in __proc_create() (fs/proc/generic.c:458) and proc_create_data() returns NULLβthe return value is ignored and sbi->procdir is still set to e.
-
Unconditional child removal (fs/ntfs3/super.c:643-654):
When the superblock is subsequently torn down (here triggered by a failed mount in do_lock_mount() -> get_mountpoint(), which calls deactivate_locked_super() -> ntfs3_kill_sb() -> kill_block_super() -> generic_shutdown_super() -> ntfs_put_super()), ntfs_remove_procdir(sb) checks only if (!sbi->procdir) and then unconditionally attempts to remove both child entries:
remove_proc_entry("label", sbi->procdir);
remove_proc_entry("volinfo", sbi->procdir);
remove_proc_entry(sb->s_id, proc_info_root);
-
Warning in procfs (fs/proc/generic.c:731-744):
Because "volinfo" was never registered under sbi->procdir, pde_subdir_find(parent, fn, len) returns NULL in remove_proc_entry(), causing remove_proc_entry() to hit:
if (!de) {
WARN(1, "name '%s'\n", name);
return;
}
at fs/proc/generic.c:742.
Lifecycle / Invariant Violation
ntfs_remove_procdir() assumes that a non-NULL sbi->procdir guarantees both "label" and "volinfo" exist as children of sbi->procdir, which is violated whenever proc_create_data() fails after proc_mkdir() succeeds. Either ntfs_create_procdir() needs to check the return values of proc_create_data() (cleaning up on failure), or ntfs_remove_procdir() should use remove_proc_subtree(sb->s_id, proc_info_root) / track created entries rather than unconditionally calling remove_proc_entry() for each child name.
▶
▼
Last patch testing requests (1)
Sample crash report:
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000003 R14: 00007fffc71496c0 R15: 00007fffc7149660
</TASK>
------------[ cut here ]------------
name 'label'
WARNING: fs/proc/generic.c:742 at remove_proc_entry+0x35a/0x690 fs/proc/generic.c:742, CPU#0: syz-executor148/5678
Modules linked in:
CPU: 0 UID: 0 PID: 5678 Comm: syz-executor148 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:remove_proc_entry+0x35f/0x690 fs/proc/generic.c:742
Code: ff e9 14 ff ff ff e8 60 2a 46 ff eb 05 e8 59 2a 46 ff 48 c7 c7 a0 70 33 90 e8 6d f1 8b 09 48 8d 3d 06 a8 41 0f 48 8b 74 24 08 <67> 48 0f b9 3a 48 83 c4 20 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc
RSP: 0018:ffffc90002d4fc68 EFLAGS: 00010286
RAX: 8000000000000000 RBX: ffff888013bd6000 RCX: ffffffff9becba01
RDX: 0000000000000001 RSI: ffffffff8c687660 RDI: ffffffff91c4d1d0
RBP: 0000000000000005 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520005a9f7c R12: 0000000000000000
R13: ffff888013bb9e9b R14: 0000000000000007 R15: dffffc0000000000
FS: 00005555807b4400(0000) GS:ffff88808a9e9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbebe2a8460 CR3: 0000000042059000 CR4: 0000000000352ef0
Call Trace:
<TASK>
ntfs_remove_procdir fs/ntfs3/super.c:650 [inline]
ntfs_put_super+0x7a/0xf0 fs/ntfs3/super.c:771
generic_shutdown_super+0x140/0x2d0 fs/super.c:723
kill_block_super+0x44/0xa0 fs/super.c:1852
ntfs3_kill_sb+0x41/0x60 fs/ntfs3/super.c:1997
deactivate_locked_super+0xbe/0x110 fs/super.c:558
cleanup_mnt+0x204/0x2a0 fs/namespace.c:1396
task_work_run+0x1d9/0x260 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
exit_to_user_mode_loop+0x204/0x770 kernel/entry/common.c:101
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
do_syscall_64+0x336/0x540 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd4fdc78817
Code: bf 41 4d 56 53 b8 9d 00 00 00 0f 05 83 f8 ea 75 a2 c7 05 54 88 08 00 00 00 00 00 eb 96 e8 61 08 00 00 90 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007fffc7149628 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000087 RCX: 00007fd4fdc78817
RDX: 0000000000000002 RSI: 0000000000000001 RDI: 00007fd4fdcd40ad
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000003 R14: 00007fffc71496c0 R15: 00007fffc7149660
</TASK>
----------------
Code disassembly (best guess):
0: ff ljmp (bad)
1: e9 14 ff ff ff jmp 0xffffff1a
6: e8 60 2a 46 ff call 0xff462a6b
b: eb 05 jmp 0x12
d: e8 59 2a 46 ff call 0xff462a6b
12: 48 c7 c7 a0 70 33 90 mov $0xffffffff903370a0,%rdi
19: e8 6d f1 8b 09 call 0x98bf18b
1e: 48 8d 3d 06 a8 41 0f lea 0xf41a806(%rip),%rdi # 0xf41a82b
25: 48 8b 74 24 08 mov 0x8(%rsp),%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 48 83 c4 20 add $0x20,%rsp
33: 5b pop %rbx
34: 41 5c pop %r12
36: 41 5d pop %r13
38: 41 5e pop %r14
3a: 41 5f pop %r15
3c: 5d pop %rbp
3d: c3 ret
3e: cc int3
3f: cc int3
* Struck through repros no longer work on HEAD.