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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 18 20:36:51 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.12.3.vz10
------>
commit 0bc33a6f9890e150fce5c8f6813328d7c3cd9669
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Date:   Sun May 24 23:32:15 2026 +0300

    ve: fix envID showing "/" instead of "0" for host ve0
    
    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().
    
    https://virtuozzo.atlassian.net/browse/VSTOR-131944
    Feature: ve: ve generic structures
    Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
    Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 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 4c7a8649ac42d..e58ffb22da87b 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -808,6 +808,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,
@@ -828,8 +832,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;
+	}
 }
 
 static void ve_devmnt_free(struct ve_devmnt *devmnt)


More information about the Devel mailing list