tests: Check that no-breakpoints restore works

Submitted by Pavel Emelianov on April 27, 2016, 10:23 a.m.

Details

Message ID 57209308.5030104@virtuozzo.com
State Rejected
Series "tests: Check that no-breakpoints restore works"
Headers show

Commit Message

Pavel Emelianov April 27, 2016, 10:23 a.m.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/include/fault-injection.h | 1 +
 criu/parasite-syscall.c        | 6 +++++-
 test/jenkins/criu-fault.sh     | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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

Comments

Cyrill Gorcunov April 27, 2016, 10:44 a.m.
On Wed, Apr 27, 2016 at 01:23:04PM +0300, Pavel Emelyanov wrote:
> 
> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
> ---
>  criu/include/fault-injection.h | 1 +
>  criu/parasite-syscall.c        | 6 +++++-
>  test/jenkins/criu-fault.sh     | 1 +
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> 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;

What about clear_breakpoints?
Pavel Emelianov April 27, 2016, noon
On 04/27/2016 01:44 PM, Cyrill Gorcunov wrote:
> On Wed, Apr 27, 2016 at 01:23:04PM +0300, Pavel Emelyanov wrote:
>>
>> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
>> ---
>>  criu/include/fault-injection.h | 1 +
>>  criu/parasite-syscall.c        | 6 +++++-
>>  test/jenkins/criu-fault.sh     | 1 +
>>  3 files changed, 7 insertions(+), 1 deletion(-)
>>
>> 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;
> 
> What about clear_breakpoints?

Hm... It worked for some reason, but yes, I agree. It's better to ban this
thing too :) Will send patch soon.

-- Pavel