All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH VZ10 v2 3/3] ve_namespace: Allow entering non-running VE namespace
Date: Wed, 9 Sep 2026 20:56:24 +0200	[thread overview]
Message-ID: <8747a28e-23c2-4ca5-abce-89039cde70bc@virtuozzo.com> (raw)
In-Reply-To: <178896443373.479408.11976716167479776365.b4-review@b4>



On 9/9/26 16:33, Vasileios Almpanis wrote:
>> This doesn't bring a lot of value and makes tests more complex.
>> To enter VE namespace we need to actually start VE.
>>
>> In vzctl we have locking to prevent parallel creations.
>> If someone decides to skip locks and start one CT
>> in parallel - big mistake, but not ours.
>>
>> https://virtuozzo.atlassian.net/browse/VSTOR-144504
>>
>> Feature: ve selftests
>> Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
>>
>> diff --git a/kernel/ve/ve_namespace.c b/kernel/ve/ve_namespace.c
>> index 3dbe0dde2645..879a7863e33f 100644
>> --- a/kernel/ve/ve_namespace.c
>> +++ b/kernel/ve/ve_namespace.c
>> @@ -227,7 +227,8 @@ static int ve_ns_install(struct nsset *nsset, struct ns_common *new)
>>   		return -EPERM;
>>   
>>   	if (!VE_IS_RUNNING(ve_ns->ve))
>> -		return -EINVAL;
>> +		pr_warn_once("Switching to a non-running ve %s.\n",
> 
> Maybe better print ve->veid instead of ve_name(). ve_offline() sets
> ve->ve_name to NULL when the ve cgroup is removed, so we will see
> "ve (null)" in that case.

We don't initialize this value in tests, it is 0.
Actually, can we have this situation? Reaching ve_ns_install means
we grabbed a ve_ns reference in validate_nsset. How can we do ->css_offline
at the same time?

> 
>> +			ve_name(ve_ns->ve));
> 
> This change means that now a host task can enter the CT before the CT
> has been started. A task can enter into the VE by two ways either
> copy_ve_ns or by switch_ve_namespace both of which call ve_setup_task.
> This function sets whether the task can be ptraced, core dumped etc
> which will be skipped because ve_setup_task checks if ve is running
> which it will not be. So here we break the invariant that tasks that
> enter into the ve from host cannot be ptraced etc. I suggest to add
> a flag to ve_setup_task entered which will be 1 for switch_ve_namespace
> and 0 for copy_ve_ns> 

Good point. I'm not sure how real it is though. It should be someone
really nasty on the host trying to poison CT, but if this nasty person
is switching VE ns - it has CAP_SYS_ADMIN already.

It can protect us from bugs in vzctl though, so I think it is not completely
useless.
What if we drop VE_IS_RUNNING(ve) in ve_setup_task?

-- 
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo

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

      reply	other threads:[~2026-09-09 18:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 12:14 [Devel] [PATCH VZ10 v2 0/3] Improvements for ve selftests Vladimir Riabchun
2026-09-09 12:14 ` [Devel] [PATCH VZ10 v2 1/3] selftests/ve: Add namespace management helpers Vladimir Riabchun
2026-09-09 14:33   ` Vasileios Almpanis
2026-09-09 12:14 ` [Devel] [PATCH VZ10 v2 2/3] selftests/ve: Add more helpers Vladimir Riabchun
2026-09-09 14:33   ` Vasileios Almpanis
2026-09-09 12:14 ` [Devel] [PATCH VZ10 v2 3/3] ve_namespace: Allow entering non-running VE namespace Vladimir Riabchun
2026-09-09 14:33   ` Vasileios Almpanis
2026-09-09 18:56     ` Vladimir Riabchun [this message]

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=8747a28e-23c2-4ca5-abce-89039cde70bc@virtuozzo.com \
    --to=vladimir.riabchun@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=vasileios.almpanis@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.