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

Kirill Tkhai ktkhai at virtuozzo.com
Fri Oct 25 12:06:25 MSK 2019


On 24.10.2019 18:51, Pavel Tikhomirov wrote:
> 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