Looks good. Please double-check that it also fixes the name printing in 
/proc/vz/veinfo (requires modprobe vzmon)

On 5/24/26 22:32, Eva Kurchatova wrote:
> 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 <[email protected]>

Reviewed-by: Pavel Tikhomirov <[email protected]>

> 
> 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);
>  }

-- 
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to