From: Breno Leitao <leitao@debian.org>
To: Edward Adam Davis <eadavis@sina.com>
Cc: syzbot+4fae162886e497f72228@syzkaller.appspotmail.com,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
a.hindborg@kernel.org
Subject: Re: [PATCH] configfs: Delay the fop setting to prevent noise generated by open
Date: Thu, 5 Nov 2026 05:06:11 -0800 [thread overview]
Message-ID: <aux-0Xxpcp7UFCs6@gmail.com> (raw)
In-Reply-To: <20261021062535.55494-1-eadavis@sina.com>
Hello Edward,
> The root cause is a race condition between open and mkdir. Add a revalidate
> for cached dentries to prevent open from accessing directories that are not
> yet ready.
Thanks for chasing this one. The analysis matches what I see: a lookup
holds the dentry of the half-built group, d_delete() can only unhash it,
and the BUG_ON() in create_default_group() fires.
The fix has a side effect, though:
> + if (flags & LOOKUP_RCU)
> + return -ECHILD;
> +
> + if (!inode)
> + return -ECHILD;
> +
> + if (!configfs_dirent_is_ready(parent_sd))
> + return -ECHILD;
-ECHILD only means "retry in ref-walk" when LOOKUP_RCU is set. In
ref-walk, lookup_fast() and lookup_dcache() hand it back as is, so it
reaches userspace, and mkdir() and open() now fail with ECHILD when they
race with a lookup.
With the syzbot setup (threads opening ports/1, ports/1/subsystems and
ports/1/ana_groups while mkdir(ports/1) runs under fail-nth), mkdir()
returned ECHILD in 2 to 11 of ~220 attempts per run, over 11 runs. The
hook also takes every configfs lookup out of RCU-walk.
Returning 0 instead would not help. The VFS would d_invalidate() the
dentry of a default group, and configfs_lookup() cannot recreate pinned
dentries.
I think the BUG_ON() itself is the bug. It assumes nobody else holds the
dentry of a default group while it is built, but a lookup can find it in
the dcache. The error path already copes with that: d_delete() unhashes
the busy dentry, the inode is S_DEAD, and lookup, open, mkdir and
symlink all refuse a group that is not ready.
Thanks,
--breno
next prev parent reply other threads:[~2026-11-05 13:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 18:08 [syzbot] kernel BUG in create_default_group syzbot
2026-10-21 5:30 ` Edward Adam Davis
2026-10-21 5:50 ` syzbot
2026-10-21 6:25 ` [PATCH] configfs: Delay the fop setting to prevent noise generated by open Edward Adam Davis
2026-10-22 10:16 ` [PATCH v2] configfs: Add revalidate for cached dentry to ensure it's ready Edward Adam Davis
2026-10-22 11:11 ` [PATCH v3] " Edward Adam Davis
2026-11-05 13:06 ` Breno Leitao [this message]
2026-10-21 9:40 ` [syzbot] kernel BUG in create_default_group Edward Adam Davis
2026-10-21 9:58 ` syzbot
2026-10-22 9:47 ` Edward Adam Davis
2026-10-22 10:04 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aux-0Xxpcp7UFCs6@gmail.com \
--to=leitao@debian.org \
--cc=a.hindborg@kernel.org \
--cc=eadavis@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+4fae162886e497f72228@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.