From: no-reply@sashiko.virtuozzo.com
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>, khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 2/4] ms/eventfs: Use children field for rcu head and add memory barriers
Date: Wed, 11 Nov 2026 20:40:40 +0000 [thread overview]
Message-ID: <010701a1cc576047-ffbf5d29-e790-4712-bd29-436bdb0a2907-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261111203529.363554-3-eva.kurchatova@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tracefs: eventfs_iterate() returns with SRCU read lock held on is_freed bail-out
--
commit 2fa07daf3577d3718d95f99a986545de113bc3c8
Author: Steven Rostedt <rostedt@goodmis.org>
ms/eventfs: Use children field for rcu head and add memory barriers
This commit overlays the rcu_head with the children list head instead of
the list head in struct eventfs_inode. It adds an smp_wmb() after setting
is_freed in free_ei(). It also adds an smp_rmb() and an is_freed check at
the top of the children iteration loop in eventfs_iterate().
Link: https://patch.msgid.link/20260808094215.4252430d@robin
> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
[ ... ]
> @@ -645,6 +655,20 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
> list_for_each_entry_srcu(ei_child, &ei->children, list,
> srcu_read_lock_held(&eventfs_srcu)) {
>
> + /*
> + * If the ei is being freed, then the ei->children may be
> + * being used as the rcu list, which means the next element
> + * may be garbage. The ei->is_free is set before switching
> + * the ei->children over to ei->rcu. The read memory barrier
> + * here makes sure the ei_child is read before is_free is
> + * updated.
> + *
> + * Matches the smp_wmb() in free_ei()
> + */
> + smp_rmb();
> + if (ei->is_freed)
> + return -EINVAL;
> +
[Severity: Medium]
Can this early return leave eventfs_srcu read-locked?
eventfs_iterate() takes the SRCU read lock near the top:
idx = srcu_read_lock(&eventfs_srcu);
Every other exit path in the function uses goto out or goto out_dec, which
reach srcu_read_unlock(&eventfs_srcu, idx). The bare return -EINVAL here
bypasses it.
If a readdir on an eventfs directory races with free_ei() setting
ei->is_freed, the iterator returns with the reader still registered on
eventfs_srcu. Grace periods on that domain then cannot complete.
call_srcu() callbacks such as free_ei_rcu, queued from release_ei(), would
not run. That would leak eventfs_inodes along with their names and
entry_attrs. Any synchronize_srcu() or srcu_barrier() on eventfs_srcu could
also hang.
Should this be ret = -EINVAL; goto out; instead?
The later commit in this series, "ms/eventfs: fix SRCU read lock leak in
eventfs_iterate()", changes this branch to do that, so the end state of the
series is correct. As posted, this commit is still broken and affects
bisectability.
> if (c > 0) {
> c--;
> continue;
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261111203529.363554-1-eva.kurchatova@virtuozzo.com?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-11 20:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 20:34 [Devel] [PATCH hci-8.1 0/4] ms/eventfs: fix kernel panic on NULL dereference Eva Kurchatova
2026-11-11 20:34 ` [Devel] [PATCH hci-8.1 1/4] ms/eventfs: Fix use-after-free in eventfs_remove_rec() Eva Kurchatova
2026-11-11 20:39 ` no-reply
2026-11-11 20:34 ` [Devel] [PATCH hci-8.1 2/4] ms/eventfs: Use children field for rcu head and add memory barriers Eva Kurchatova
2026-11-11 20:40 ` no-reply [this message]
2026-11-11 20:34 ` [Devel] [PATCH hci-8.1 3/4] ms/eventfs: fix SRCU read lock leak in eventfs_iterate() Eva Kurchatova
2026-11-11 20:39 ` no-reply
2026-11-11 20:34 ` [Devel] [PATCH hci-8.1 4/4] ms/eventfs: Initialize ei->children and ei->list in init_ei() Eva Kurchatova
2026-11-11 20:40 ` no-reply
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=010701a1cc576047-ffbf5d29-e790-4712-bd29-436bdb0a2907-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=eva.kurchatova@virtuozzo.com \
--cc=khorenko@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox