syzbot
WARNING: proc registration bug in ntfs_put_super
Status:
moderation: reported on 2026/11/23 15:55
Subsystems:
ntfs3
Labels:
prio:low
[Documentation on labels]
Reported-by: syzbot+98d17884f7babbf2d711@syzkaller.appspotmail.com
First crash: 2h33m, last: 2h33m
β¨ 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.
Sample crash report:
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
fail_dump lib/fault-inject.c:80 [inline]
should_fail_ex+0x3eb/0x540 lib/fault-inject.c:181
should_failslab+0xa8/0x100 mm/failslab.c:46
slab_pre_alloc_hook mm/slub.c:4675 [inline]
slab_alloc_node mm/slub.c:5011 [inline]
kmem_cache_alloc_noprof+0x9c/0x600 mm/slub.c:5047
__proc_create+0x55d/0xad0 fs/proc/generic.c:458
proc_create_reg fs/proc/generic.c:584 [inline]
proc_create_data+0xa5/0x190 fs/proc/generic.c:598
ntfs_create_procdir+0x8b/0xe0 fs/ntfs3/super.c:637
ntfs_fill_super+0x4813/0x49c0 fs/ntfs3/super.c:1810
get_tree_bdev_flags+0x436/0x500 fs/super.c:1821
vfs_get_tree+0x92/0x2a0 fs/super.c:1881
fc_mount fs/namespace.c:1282 [inline]
do_new_mount_fc fs/namespace.c:3910 [inline]
do_new_mount+0x325/0xb00 fs/namespace.c:3986
do_mount fs/namespace.c:4350 [inline]
__do_sys_mount fs/namespace.c:4563 [inline]
__se_sys_mount+0x31d/0x420 fs/namespace.c:4540
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f07cf3aa7ba
Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f07d0310e18 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f07d0310ea0 RCX: 00007f07cf3aa7ba
RDX: 00002000000108c0 RSI: 0000200000010900 RDI: 00007f07d0310e60
RBP: 00002000000108c0 R08: 00007f07d0310ea0 R09: 00000000000144c2
R10: 00000000000144c2 R11: 0000000000000246 R12: 0000200000010900
R13: 00007f07d0310e60 R14: 000000000001f783 R15: 0000200000010940
</TASK>
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 5, space 0, times 91
CPU: 0 UID: 0 PID: 5350 Comm: syz.0.0 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
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
fail_dump lib/fault-inject.c:80 [inline]
should_fail_ex+0x3eb/0x540 lib/fault-inject.c:181
should_failslab+0xa8/0x100 mm/failslab.c:46
slab_pre_alloc_hook mm/slub.c:4675 [inline]
slab_alloc_node mm/slub.c:5011 [inline]
__kmalloc_cache_noprof+0x9e/0x600 mm/slub.c:5676
_kmalloc_noprof include/linux/slab.h:991 [inline]
get_mountpoint+0x2cc/0x530 fs/namespace.c:943
do_lock_mount+0x64f/0xd40 fs/namespace.c:2877
do_new_mount_fc fs/namespace.c:3928 [inline]
do_new_mount+0x485/0xb00 fs/namespace.c:3986
do_mount fs/namespace.c:4350 [inline]
__do_sys_mount fs/namespace.c:4563 [inline]
__se_sys_mount+0x31d/0x420 fs/namespace.c:4540
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f07cf3aa7ba
Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f07d0310e18 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f07d0310ea0 RCX: 00007f07cf3aa7ba
RDX: 00002000000108c0 RSI: 0000200000010900 RDI: 00007f07d0310e60
RBP: 00002000000108c0 R08: 00007f07d0310ea0 R09: 00000000000144c2
R10: 00000000000144c2 R11: 0000000000000246 R12: 0000200000010900
R13: 00007f07d0310e60 R14: 000000000001f783 R15: 0000200000010940
</TASK>
------------[ cut here ]------------
name 'volinfo'
WARNING: fs/proc/generic.c:742 at remove_proc_entry+0x35a/0x690 fs/proc/generic.c:742, CPU#0: syz.0.0/5350
Modules linked in:
CPU: 0 UID: 0 PID: 5350 Comm: syz.0.0 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 40 38 46 ff eb 05 e8 39 38 46 ff 48 c7 c7 60 70 33 90 e8 2d b1 8b 09 48 8d 3d 66 b0 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:ffffc9000e2f7c68 EFLAGS: 00010286
RAX: 8000000000000000 RBX: ffff8880419c2140 RCX: ffffffff9becaa01
RDX: ffffc9000ef6a001 RSI: ffffffff8c6873c0 RDI: ffffffff91c4ca70
RBP: 0000000000000007 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff52001c5ef7c R12: 0000000000000000
R13: ffffffff8c6873c0 R14: ffff8880419c21f0 R15: dffffc0000000000
FS: 00007f07d03116c0(0000) GS:ffff88808a9ea000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055ed373b7a08 CR3: 0000000045373000 CR4: 0000000000352ef0
Call Trace:
<TASK>
ntfs_remove_procdir fs/ntfs3/super.c:651 [inline]
ntfs_put_super+0x99/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:0x7f07cf3aa7ba
Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f07d0310e18 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: fffffffffffffff4 RBX: 00007f07d0310ea0 RCX: 00007f07cf3aa7ba
RDX: 00002000000108c0 RSI: 0000200000010900 RDI: 00007f07d0310e60
RBP: 00002000000108c0 R08: 00007f07d0310ea0 R09: 00000000000144c2
R10: 00000000000144c2 R11: 0000000000000246 R12: 0000200000010900
R13: 00007f07d0310e60 R14: 000000000001f783 R15: 0000200000010940
</TASK>
----------------
Code disassembly (best guess):
0: ff ljmp (bad)
1: e9 14 ff ff ff jmp 0xffffff1a
6: e8 40 38 46 ff call 0xff46384b
b: eb 05 jmp 0x12
d: e8 39 38 46 ff call 0xff46384b
12: 48 c7 c7 60 70 33 90 mov $0xffffffff90337060,%rdi
19: e8 2d b1 8b 09 call 0x98bb14b
1e: 48 8d 3d 66 b0 41 0f lea 0xf41b066(%rip),%rdi # 0xf41b08b
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.