OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir()
@ 2026-11-17  5:50 Eva Kurchatova
  2026-11-17  5:55 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eva Kurchatova @ 2026-11-17  5:50 UTC (permalink / raw)
  To: khorenko; +Cc: devel

From: Al Viro <viro@zeniv.linux.org.uk>

[ Upstream commit 798a401660a151633cb171738a72a8f1efb9b0b4 ]

If we have LOCKDOWN_TRACEFS, the function bails out - *after*
having locked the parent directory and without bothering to
undo that.  Just check it before tracefs_start_creating()...

Fixes: e24709454c45 "tracefs/eventfs: Add missing lockdown checks"
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3bcb274a192fc89a003a7808a877faf1f9a81ce3)

https://virtuozzo.atlassian.net/browse/VSTOR-155413
Feature: fix ms/tracefs

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 fs/tracefs/event_inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 357663cfd4ba..e060dfe7cdac 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -793,7 +793,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
 						const struct eventfs_entry *entries,
 						int size, void *data)
 {
-	struct dentry *dentry = tracefs_start_creating(name, parent);
+	struct dentry *dentry;
 	struct eventfs_root_inode *rei;
 	struct eventfs_inode *ei;
 	struct tracefs_inode *ti;
@@ -804,6 +804,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
 	if (security_locked_down(LOCKDOWN_TRACEFS))
 		return NULL;
 
+	dentry = tracefs_start_creating(name, parent);
 	if (IS_ERR(dentry))
 		return ERR_CAST(dentry);
 
-- 
2.56.1

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir()
  2026-11-17  5:50 [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir() Eva Kurchatova
@ 2026-11-17  5:55 ` no-reply
  2026-11-17  6:02   ` Eva Kurchatova (Virtuozzo)
  2026-11-17 15:16 ` Konstantin Khorenko
  2026-11-17 15:16 ` Konstantin Khorenko
  2 siblings, 1 reply; 5+ messages in thread
From: no-reply @ 2026-11-17  5:55 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] Fixes trailer lacks parentheses around the quoted subject
--

commit 19e003c422eeb3e947b70fcf695dd6a60f9073e4
Author: Al Viro <viro@zeniv.linux.org.uk>

ms/tracefs: fix a leak in eventfs_create_events_dir()

This commit moves the tracefs_start_creating() call in eventfs_create_events_dir() to after the security_locked_down(LOCKDOWN_TRACEFS) check. A lockdown bail-out then no longer leaves the parent directory locked.

> ms/tracefs: fix a leak in eventfs_create_events_dir()
>
> [ Upstream commit 798a401660a151633cb171738a72a8f1efb9b0b4 ]
>
> If we have LOCKDOWN_TRACEFS, the function bails out - *after*
> having locked the parent directory and without bothering to
> undo that.  Just check it before tracefs_start_creating()...
>
> Fixes: e24709454c45 "tracefs/eventfs: Add missing lockdown checks"
> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> (cherry picked from commit 3bcb274a192fc89a003a7808a877faf1f9a81ce3)
>
> https://virtuozzo.atlassian.net/browse/VSTOR-155413
> Feature: fix ms/tracefs
>
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

[Severity: Low]
This isn't a functional problem, but the Fixes: trailer is malformed. The subject is not enclosed in parentheses, so Fixes-parsing tooling may not recognise it. Should it read:

  Fixes: e24709454c45 ("tracefs/eventfs: Add missing lockdown checks")

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir()
  2026-11-17  5:55 ` no-reply
@ 2026-11-17  6:02   ` Eva Kurchatova (Virtuozzo)
  0 siblings, 0 replies; 5+ messages in thread
From: Eva Kurchatova (Virtuozzo) @ 2026-11-17  6:02 UTC (permalink / raw)
  To: no-reply, khorenko; +Cc: devel


On 11/17/26 07:55, no-reply@sashiko.virtuozzo.com wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] Fixes trailer lacks parentheses around the quoted subject
> --
>
> commit 19e003c422eeb3e947b70fcf695dd6a60f9073e4
> Author: Al Viro <viro@zeniv.linux.org.uk>
>
> ms/tracefs: fix a leak in eventfs_create_events_dir()
>
> This commit moves the tracefs_start_creating() call in eventfs_create_events_dir() to after the security_locked_down(LOCKDOWN_TRACEFS) check. A lockdown bail-out then no longer leaves the parent directory locked.
>
>> ms/tracefs: fix a leak in eventfs_create_events_dir()
>>
>> [ Upstream commit 798a401660a151633cb171738a72a8f1efb9b0b4 ]
>>
>> If we have LOCKDOWN_TRACEFS, the function bails out - *after*
>> having locked the parent directory and without bothering to
>> undo that.  Just check it before tracefs_start_creating()...
>>
>> Fixes: e24709454c45 "tracefs/eventfs: Add missing lockdown checks"
>> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> (cherry picked from commit 3bcb274a192fc89a003a7808a877faf1f9a81ce3)
>>
>> https://virtuozzo.atlassian.net/browse/VSTOR-155413
>> Feature: fix ms/tracefs
>>
>> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> [Severity: Low]
> This isn't a functional problem, but the Fixes: trailer is malformed. The subject is not enclosed in parentheses, so Fixes-parsing tooling may not recognise it. Should it read:
>
>    Fixes: e24709454c45 ("tracefs/eventfs: Add missing lockdown checks")


This is how both upstream commit 798a401660a1, and the 6.12.y commit 
3bcb274a192f look like. The cherry-pick copied them verbatim.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir()
  2026-11-17  5:50 [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir() Eva Kurchatova
  2026-11-17  5:55 ` no-reply
@ 2026-11-17 15:16 ` Konstantin Khorenko
  2026-11-17 15:16 ` Konstantin Khorenko
  2 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 15:16 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

Applying as is.

On Tue, 17 Nov 2026 07:50:39 +0200, Eva Kurchatova wrote:
> If we have LOCKDOWN_TRACEFS, the function bails out - *after*
> having locked the parent directory and without bothering to
> undo that.  Just check it before tracefs_start_creating()...

The backport is the 6.12.y commit as is, and the leak is in our tree.

Separate patches, not needed for this one:

1. The other fix of VSTOR-155413, 14f7f52629d91 ("tracefs: Fix
   default permissions not being applied on initial mount"), is still
   missing: tracefs_fill_super() does not apply the mount options, so
   the tracefs root comes up 0755 instead of 0700. Please send it too.
   https://virtuozzo.atlassian.net/browse/VSTOR-155413

2. Same in mainline: on lockdown eventfs_create_events_dir() returns
   NULL, create_event_toplevel_files() checks only IS_ERR(), and
   removing that instance calls eventfs_remove_events_dir(NULL), which
   dereferences it in get_root_inode(). Before this patch the case hung
   on the leaked lock, now rmdir oopses. It needs root and a lockdown
   change racing with the instance creation. To be fixed upstream
   first, I created a task for it:
   https://virtuozzo.atlassian.net/browse/VSTOR-155526

Thanks.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir()
  2026-11-17  5:50 [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir() Eva Kurchatova
  2026-11-17  5:55 ` no-reply
  2026-11-17 15:16 ` Konstantin Khorenko
@ 2026-11-17 15:16 ` Konstantin Khorenko
  2 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 15:16 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Tue, 17 Nov 2026 07:50:39 +0200, Eva Kurchatova wrote:
> ms/tracefs: fix a leak in eventfs_create_events_dir()

Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.24.3.vz10, thanks!

[1/1] ms/tracefs: fix a leak in eventfs_create_events_dir()
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/f386929460e7

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-17 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17  5:50 [Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir() Eva Kurchatova
2026-11-17  5:55 ` no-reply
2026-11-17  6:02   ` Eva Kurchatova (Virtuozzo)
2026-11-17 15:16 ` Konstantin Khorenko
2026-11-17 15:16 ` Konstantin Khorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox