[CRIU] [PATCH v2] tests: Check that no-breakpoints restore works

Andrew Vagin avagin at virtuozzo.com
Tue May 3 16:18:08 PDT 2016


On Wed, Apr 27, 2016 at 03:03:23PM +0300, Pavel Emelyanov wrote:
> v2: Don't clear_breakpoints too.
> 

Acked-by: Andrew Vagin <avagin at virtuozzo.com>

> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> ---
>  criu/cr-restore.c              | 3 +++
>  criu/include/fault-injection.h | 1 +
>  criu/parasite-syscall.c        | 6 +++++-
>  test/jenkins/criu-fault.sh     | 1 +
>  4 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index 6ee0850..36b79f5 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -1894,6 +1894,9 @@ static int clear_breakpoints()
>  	struct pstree_item *item;
>  	int ret = 0, i;
>  
> +	if (fault_injected(FI_NO_BREAKPOINTS))
> +		return 0;
> +
>  	for_each_pstree_item(item) {
>  		if (!task_alive(item))
>  			continue;
> diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
> index c69a1c9..f1e5c72 100644
> --- a/criu/include/fault-injection.h
> +++ b/criu/include/fault-injection.h
> @@ -10,6 +10,7 @@ enum faults {
>  	/* not fatal */
>  	FI_CHECK_OPEN_HANDLE = 128,
>  	FI_NO_MEMFD = 129,
> +	FI_NO_BREAKPOINTS = 130,
>  	FI_MAX,
>  };
>  
> diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
> index a5b2fc7..f9e0bac 100644
> --- a/criu/parasite-syscall.c
> +++ b/criu/parasite-syscall.c
> @@ -1428,7 +1428,11 @@ int ptrace_stop_pie(pid_t pid, void *addr, enum trace_flags *tf)
>  {
>  	int ret;
>  
> -	ret = ptrace_set_breakpoint(pid, addr);
> +	if (fault_injected(FI_NO_BREAKPOINTS)) {
> +		pr_debug("Force no-breakpoints restore\n");
> +		ret = 0;
> +	} else
> +		ret = ptrace_set_breakpoint(pid, addr);
>  	if (ret < 0)
>  		return ret;
>  
> diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
> index b74566c..6a55aac 100755
> --- a/test/jenkins/criu-fault.sh
> +++ b/test/jenkins/criu-fault.sh
> @@ -7,3 +7,4 @@ prep
>  ./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || fail
>  ./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail
>  ./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail
> +./test/zdtm.py run -t zdtm/transition/fork --fault 130 -f h || fail
> -- 
> 2.5.0
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list