We've had a number of panics that seem to occur on hosts with heavy process churn. The symptoms are a panic when invalidating /proc entries as a task is exiting: queued_spin_lock_slowpath+0x153/0x270 shrink_dentry_list+0x11d/0x220 shrink_dcache_parent+0x68/0x110 d_invalidate+0x90/0x170 proc_invalidate_siblings_dcache+0xc8/0x140 release_task+0x41b/0x510 do_exit+0x3d8/0x9d0 do_group_exit+0x7d/0xa0 get_signal+0x2a9/0x6a0 arch_do_signal_or_restart+0x1a/0x1c0 syscall_exit_to_user_mode+0xe6/0x1c0 do_syscall_64+0x74/0x130 entry_SYSCALL_64_after_hwframe+0x4b/0x53 The problem appears to be a UAF. It's freeing a shrink list of dentries, but one of the dentries on it has already been freed. The d_lru field is always list_del_init()'ed, and so should be empty whenever a dentry is freed. Add a WARN_ON_ONCE() whenever it isn't. Signed-off-by: Jeff Layton --- We've had some of these panics internally for a while. Additionally, Claude also noted that these syzbot reports may be related: https://syzbot.org/bug?extid=0aee5e8066eddbbe7397 https://syzbot.org/bug?extid=e8b3520b53e78e90034e https://syzbot.org/bug?extid=ad14fd37e76c579511d0 So far, I've been unable to spot the bug. Hoping this will make it easier. --- fs/dcache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/dcache.c b/fs/dcache.c index 7ba1801d8132..c6f475d940e3 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -429,6 +429,7 @@ static inline void __d_clear_type_and_inode(struct dentry *dentry) static void dentry_free(struct dentry *dentry) { WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias)); + WARN_ON_ONCE(!list_empty(&dentry->d_lru)); if (unlikely(dname_external(dentry))) { struct external_name *p = external_name(dentry); if (likely(atomic_dec_and_test(&p->count))) { --- base-commit: d8a9a4b11a137909e306e50346148fc5c3b63f9d change-id: 20260403-dcache-warn-a493b0e3c877 Best regards, -- Jeff Layton