[Devel] [PATCH RHEL7 COMMIT] ve: add a comment about possible pseudosuper race

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 25 13:40:57 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-1062.1.2.vz7.114.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.1.2.vz7.114.9
------>
commit 7606beb9a2c57b70e2d84e2022c91cb41d6be31a
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Fri Oct 25 13:40:56 2019 +0300

    ve: add a comment about possible pseudosuper race
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 kernel/ve/ve.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 4565f39c8874..ad3a698ba9de 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1345,6 +1345,18 @@ static int ve_write_pseudosuper(struct cgroup *cg,
 		return -EBUSY;
 	}
 	ve->is_pseudosuper = value;
+	/*
+	 * In criu we do unset pseudosuper on ve cgroup just before doing
+	 * ptrace(PTRACE_DETACH) to release restored process, what if one of
+	 * them will see pseudosuper flag still set to 1?
+	 *
+	 * To be 100% sure that these will never happen we need to call
+	 * synchronize_sched_expedited(); here to make cross cpu memory
+	 * barrier.
+	 *
+	 * For now we rely on userspace that ptrace from criu will do wake-up
+	 * on CT tasks which should imply memory barrier.
+	 */
 	up_write(&ve->op_sem);
 
 	return 0;



More information about the Devel mailing list