From: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.2 v2 2/6] ve: hide only the tasks the host sends into a VE
Date: Tue, 17 Nov 2026 14:13:22 +0400 [thread overview]
Message-ID: <20261117101329.225854-3-mirian.shilakadze@virtuozzo.com> (raw)
In-Reply-To: <20261117101329.225854-1-mirian.shilakadze@virtuozzo.com>
ve_setup_task() marks a task entering a running VE VD_VE_ENTER_TASK,
which hides it from ptrace and /proc/<pid>/exe inside the VE. A
container task gets the mark too when it setns()es into its own VE or
enters a nested one, and a host task entering a stopping or stopped VE
is not hidden at all.
The mark says a task is the host's, a later change lets it skip the
mount limit of a pseudosuper VE, and it goes to the mm, which a
container task may share with others. So mark only tasks coming from
the host, in every VE state but starting, which the next change
handles. A task entering its nested VE is no longer hidden there. In a
pseudosuper VE the host's tasks cannot be told from the container's
yet, so a task leaving one is still marked until the next change.
Feature: trace: prohibit tracing sensitive tasks from CT
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@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 72a2834707c5..ff1c7f9b88c7 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1837,8 +1837,14 @@ void ve_setup_task(struct task_struct *task, struct ve_struct *old_ve,
if (ve == &ve0)
return;
- /* this prohibits ptracing of task entered to VE from host system */
- if (VE_IS_RUNNING(ve) && task->mm)
+ /*
+ * A task the host sends into a started VE is hidden from the tasks of
+ * the VE. The mark goes to the mm, which may be shared, so a task
+ * coming from a container never gets it, unless the container is
+ * pseudosuper: the host's tasks there cannot be told from its own.
+ */
+ if (task->mm && old_ve != ve && ve->state != VE_STATE_STARTING &&
+ (ve_is_super(old_ve) || old_ve->is_pseudosuper))
task->mm->vps_dumpable = VD_VE_ENTER_TASK;
/* Drop OOM protection. */
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-17 10:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 10:13 [Devel] [PATCH hci-8.2 v2 0/6] ve: give the pseudosuper privileges only to the tasks setting up " Mirian Shilakadze
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 1/6] ve: tell ve_setup_task() which VE the task comes from Mirian Shilakadze
2026-11-17 10:20 ` no-reply
2026-11-17 10:13 ` Mirian Shilakadze [this message]
2026-11-17 10:22 ` [Devel] [PATCH hci-8.2 v2 2/6] ve: hide only the tasks the host sends into a VE no-reply
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 3/6] ve: hide the tasks that set up a starting VE from the rest of it Mirian Shilakadze
2026-11-17 10:27 ` no-reply
2026-11-17 11:40 ` Konstantin Khorenko
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks Mirian Shilakadze
2026-11-17 10:30 ` no-reply
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 5/6] fs: keep the mount relaxations of a pseudosuper VE from container binaries Mirian Shilakadze
2026-11-17 10:33 ` no-reply
2026-11-17 11:40 ` Konstantin Khorenko
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 6/6] ve: give the remaining pseudosuper relaxations only to setup tasks Mirian Shilakadze
2026-11-17 10:35 ` no-reply
2026-11-17 11:40 ` [Devel] [PATCH hci-8.2 v2 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Konstantin Khorenko
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=20261117101329.225854-3-mirian.shilakadze@virtuozzo.com \
--to=mirian.shilakadze@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=ptikhomirov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox