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

Pavel Emelyanov xemul at virtuozzo.com
Wed Apr 27 05:41:04 PDT 2016


On 04/27/2016 03:13 PM, Cyrill Gorcunov wrote:
> On Wed, Apr 27, 2016 at 03:03:23PM +0300, Pavel Emelyanov wrote:
>> v2: Don't clear_breakpoints too.
>>
>> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> 
> Maybe something like?

This will make fault injection not work when (if) we have them
implemented for other architectures.

Also my variant simply avoids pstree items loop in clear_breakpoints,
while yours will flood the logs with "... skip flushing" messages ;)

-- Pavel

> ---
> diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
> index 8fd82ee674b6..3b79d74ac27a 100644
> --- a/criu/arch/x86/crtools.c
> +++ b/criu/arch/x86/crtools.c
> @@ -649,6 +649,11 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
>  {
>  	int ret;
>  
> +	if (fault_injected(FI_NO_BREAKPOINTS)) {
> +		pr_debug("Force disabling of HW breakpoints, skip arming\n");
> +		return 0;
> +	}
> +
>  	/* Set a breakpoint */
>  	if (ptrace(PTRACE_POKEUSER, pid,
>  			offsetof(struct user, u_debugreg[DR_FIRSTADDR]),
> @@ -676,6 +681,11 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
>  
>  int ptrace_flush_breakpoints(pid_t pid)
>  {
> +	if (fault_injected(FI_NO_BREAKPOINTS)) {
> +		pr_debug("Force disabling of HW breakpoints, skip flushing\n");
> +		return 0;
> +	}
> +
>  	/* Disable the breakpoint */
>  	if (ptrace(PTRACE_POKEUSER, pid,
>  			offsetof(struct user, u_debugreg[DR_CONTROL]),
> .
> 



More information about the CRIU mailing list