OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: khorenko@virtuozzo.com, Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v2 5/5] ms/eventfs: Initialize ei->children and ei->list in init_ei()
Date: Thu, 12 Nov 2026 00:16:17 +0000	[thread overview]
Message-ID: <010701a1cd1cc734-850ced47-7895-48e6-be8d-ac2f01502076-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261112000926.381308-7-eva.kurchatova@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] tracefs: commit message names eventfs_create_dir() but the fix targets eventfs_create_events_dir()
--

commit 9d0d1df3c54a5c4e101ce47e1ff3727b67a3af30
Author: Deepanshu Kartikey <kartikey406@gmail.com>

ms/eventfs: Initialize ei->children and ei->list in init_ei()

This commit moves the INIT_LIST_HEAD() calls for ei->children and ei->list
into init_ei(), so every eventfs_inode gets initialized lists at allocation
time. The calls are removed from eventfs_create_dir() and
eventfs_create_events_dir().

Link: https://patch.msgid.link/20260824144653.54044-1-kartikey406@gmail.com

The commit message has an inaccuracy about which function is affected.

> eventfs_create_dir() allocates the eventfs_inode and initializes it with
> init_ei(). But this does not initialize the eventfs_inode list_heads. If
> the eventfs_create_dir() fails due to memory pressure, it will call
> free_ei() before it initialized the lists, and that checks to make sure
> the eventfs_inode has no children. But because the list wasn't
> initialized, it will give a false warning.

[Severity: Low]
Is this description accurate for eventfs_create_dir()?

In eventfs_create_dir(), alloc_ei() is followed directly by plain field
assignments, and the list initialization came right after those:

fs/tracefs/event_inode.c:eventfs_create_dir() {
    ...
	ei = alloc_ei(name);
	if (!ei)
		return ERR_PTR(-ENOMEM);

	ei->entries = entries;
	ei->nr_entries = size;
	ei->data = data;
    ...
}

There is no failure window between init_ei() and the old INIT_LIST_HEAD()
calls. If alloc_ei() fails, free_ei() is not reached. The only
cleanup_ei() call runs after the lists were already initialized, so the
WARN_ON_ONCE(!list_empty(&ei->children)) in free_ei() cannot fire falsely
there.

The false warning looks reachable in eventfs_create_events_dir(), where
alloc_root_ei() succeeds and tracefs_get_inode() then fails:

fs/tracefs/event_inode.c:eventfs_create_events_dir() {
    ...
	ei = alloc_root_ei(name);
	if (!ei)
		goto fail;

	inode = tracefs_get_inode(dentry->d_sb);
	if (unlikely(!inode))
		goto fail;
    ...
 fail:
	cleanup_ei(ei);
	tracefs_failed_creating(dentry);
    ...
}

On that path the lists were still zeroed from kzalloc, so list_empty() on
ei->children returns false and the warning fires. The code change covers
this path too, since init_ei() is shared by alloc_ei() and alloc_root_ei().

Could the commit message name eventfs_create_events_dir() as the function
whose failure path triggered the warning? The text is the same as in the
upstream commit, so this does not affect the code change itself.

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261112000926.381308-2-eva.kurchatova@virtuozzo.com?part=5

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-12  0:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  0:07 [Devel] [PATCH hci-8.1 v2 0/5] ms/eventfs: fix kernel panic on NULL dereference Eva Kurchatova
2026-11-12  0:07 ` [Devel] [PATCH hci-8.1 v2 1/5] ms/eventfs: Hold eventfs_mutex and SRCU when remount walks events Eva Kurchatova
2026-11-12  0:15   ` no-reply
2026-11-12 16:43   ` Konstantin Khorenko
2026-11-12  0:07 ` [Devel] [PATCH hci-8.1 v2 2/5] ms/eventfs: Fix use-after-free in eventfs_remove_rec() Eva Kurchatova
2026-11-12  0:13   ` no-reply
2026-11-12 16:43   ` Konstantin Khorenko
2026-11-12  0:07 ` [Devel] [PATCH hci-8.1 v2 3/5] ms/eventfs: Use children field for rcu head and add memory barriers Eva Kurchatova
2026-11-12  0:16   ` no-reply
2026-11-12  4:18     ` Eva Kurchatova (Virtuozzo)
2026-11-12 16:43   ` Konstantin Khorenko
2026-11-12  0:07 ` [Devel] [PATCH hci-8.1 v2 4/5] ms/eventfs: fix SRCU read lock leak in eventfs_iterate() Eva Kurchatova
2026-11-12  0:15   ` no-reply
2026-11-12 16:43   ` Konstantin Khorenko
2026-11-12  0:07 ` [Devel] [PATCH hci-8.1 v2 5/5] ms/eventfs: Initialize ei->children and ei->list in init_ei() Eva Kurchatova
2026-11-12  0:16   ` no-reply [this message]
2026-11-12 16:43   ` Konstantin Khorenko
2026-11-12 16:43 ` [Devel] [PATCH hci-8.1 v2 0/5] ms/eventfs: fix kernel panic on NULL dereference Konstantin Khorenko
2026-11-12 16:50 ` Konstantin Khorenko

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=010701a1cd1cc734-850ced47-7895-48e6-be8d-ac2f01502076-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