[CRIU] Re: [PATCH cr] mm: mark a vma as stack, if a value of sp is in it

Pavel Emelyanov xemul at parallels.com
Fri Sep 7 08:52:10 EDT 2012


On 09/07/2012 03:51 PM, Andrey Vagin wrote:
> 
> /proc/PID/maps can contains not up to date information about a stack vma.
> A kernel marks a VMA as stack, if thread_struct->usersp is in it,
> but usersp is updated, when a process calls a syscall.
> 
> This problem is occured, when we try to dump/restore a process in a loop.
> When a restorer resumes a process, a restorer vma will be marked as stack.
> 
> A thread stack should not be marked as stack, because its vma is mapped
> w/o MAP_GROWSDOWN.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  cr-dump.c      |    8 ++++++--
>  cr-restore.c   |    2 ++
>  include/util.h |    2 ++
>  proc_parse.c   |    5 +----
>  util.c         |   14 ++++++++++++++
>  5 files changed, 25 insertions(+), 6 deletions(-)
> 

> @@ -1222,6 +1222,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
>  	if (ret < 0)
>  		goto err;
>  
> +	mark_stack_vma((long) &self_vma_list, &self_vma_list);

Why restorer obj here? We should find which vma covers the _new_ stack which is
in new_sp variable.

> +
>  	self_vmas_len = round_up((ret + 1) * sizeof(VmaEntry), PAGE_SIZE);
>  	vmas_len = round_up((nr_vmas + 1) * sizeof(VmaEntry), PAGE_SIZE);
>  



More information about the CRIU mailing list