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, and the mark goes to the mm, which it may share with another task. A host task entering a stopping or stopped VE is not hidden at all.
Mark only tasks coming from the host, and do it in every VE state but starting, which the next change handles. Feature: trace: prohibit tracing sensitive tasks from CT https://virtuozzo.atlassian.net/browse/VSTOR-151265 Signed-off-by: Mirian Shilakadze <[email protected]> --- kernel/ve/ve.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index 29d68594bcde..4db2d06da643 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -1847,8 +1847,12 @@ 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. + */ + if (task->mm && ve_is_super(old_ve) && ve->state != VE_STATE_STARTING) task->mm->vps_dumpable = VD_VE_ENTER_TASK; /* Drop OOM protection. */ -- 2.43.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
