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

Cyrill Gorcunov gorcunov at gmail.com
Wed Apr 27 05:13:08 PDT 2016


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?
---
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