[Devel] [PATCH vz10] ve: fix envID showing "/" instead of "0" for host ve0

Eva Kurchatova eva.kurchatova at virtuozzo.com
Sun May 24 23:32:15 MSK 2026


ve0 is statically initialized with .ve_name = "0", but ve_online()
unconditionally overwrites it with cgroup name, which returns "/"
for the root cgroup.

In the vz7 kernel this didn't happen because ve_create() had an early
`goto do_init` for the root cgroup that skipped the name assignment
entirely, preserving the static "0". The current kernel's split into
css_alloc/css_online lost that guard.

Skip ve_name assignment in ve_online() for ve0, and correspondingly
skip kfree() on the static string in ve_offline().

Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>

https://virtuozzo.atlassian.net/browse/VSTOR-131944
Feature: ve: ve generic structures
---
 kernel/ve/ve.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 106fc225c60d..97442585d7bc 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1040,6 +1040,10 @@ static int ve_online(struct cgroup_subsys_state *css)
 	static DEFINE_MUTEX(ve_name_mutex);
 	struct ve_struct *ve = css_to_ve(css);
 
+	/* ve0 has a statically initialized ve_name; skip overwriting it */
+	if (ve_is_super(ve))
+		return 0;
+
 	mutex_lock(&ve_name_mutex);
 	/*
 	 * Cache ve_name to have it directly accessed. But keep in mind,
@@ -1060,8 +1064,10 @@ static void ve_offline(struct cgroup_subsys_state *css)
 {
 	struct ve_struct *ve = css_to_ve(css);
 
-	kfree(ve->ve_name);
-	ve->ve_name = NULL;
+	if (!ve_is_super(ve)) {
+		kfree(ve->ve_name);
+		ve->ve_name = NULL;
+	}
 
 	ve_cleanup_ra_data(ve, NULL);
 }
-- 
2.54.0



More information about the Devel mailing list