Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfu.lin <fulin10@huawei.com>2022-08-09 22:18:00 +0300
committerAndrei Vagin <avagin@gmail.com>2022-08-15 08:23:49 +0300
commitec49f42018dfb4beb6620bbaf6623e2c7cc4a5c7 (patch)
tree2116ad12ddf3ec3693f7fa2fb58e2556735b1bc8
parentcc8c6b4cd474821c61747b5d7e56c5b70e8de3bb (diff)
breakpoint: enable breakpoints by default on amd64 and arm64
Signed-off-by: fu.lin <fulin10@huawei.com> Signed-off-by: Andrei Vagin <avagin@gmail.com>
-rw-r--r--compel/arch/aarch64/src/lib/infect.c12
-rw-r--r--compel/arch/x86/src/lib/infect.c11
-rw-r--r--criu/include/fault-injection.h8
3 files changed, 23 insertions, 8 deletions
diff --git a/compel/arch/aarch64/src/lib/infect.c b/compel/arch/aarch64/src/lib/infect.c
index 7b75da890..d0189f003 100644
--- a/compel/arch/aarch64/src/lib/infect.c
+++ b/compel/arch/aarch64/src/lib/infect.c
@@ -207,6 +207,7 @@ static struct hwbp_cap *ptrace_get_hwbp_cap(pid_t pid)
int ptrace_set_breakpoint(pid_t pid, void *addr)
{
+ k_rtsigset_t block;
struct hwbp_cap *info = ptrace_get_hwbp_cap(pid);
struct user_hwdebug_state regs = {};
unsigned int ctrl = 0;
@@ -242,6 +243,17 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
if (ptrace(PTRACE_SETREGSET, pid, NT_ARM_HW_BREAK, &iovec))
return -1;
+ /*
+ * FIXME(issues/1429): SIGTRAP can't be blocked, otherwise its handler
+ * will be reset to the default one.
+ */
+ ksigfillset(&block);
+ ksigdelset(&block, SIGTRAP);
+ if (ptrace(PTRACE_SETSIGMASK, pid, sizeof(k_rtsigset_t), &block)) {
+ pr_perror("Can't block signals for %d", pid);
+ return -1;
+ }
+
if (ptrace(PTRACE_CONT, pid, NULL, NULL) != 0) {
pr_perror("Unable to restart the stopped tracee process %d", pid);
return -1;
diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
index c0e7a544a..01959b95b 100644
--- a/compel/arch/x86/src/lib/infect.c
+++ b/compel/arch/x86/src/lib/infect.c
@@ -588,6 +588,7 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
int ptrace_set_breakpoint(pid_t pid, void *addr)
{
+ k_rtsigset_t block;
int ret;
/* Set a breakpoint */
@@ -603,6 +604,16 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
return -1;
}
+ /*
+ * FIXME(issues/1429): SIGTRAP can't be blocked, otherwise its handler
+ * will be reset to the default one.
+ */
+ ksigfillset(&block);
+ ksigdelset(&block, SIGTRAP);
+ if (ptrace(PTRACE_SETSIGMASK, pid, sizeof(k_rtsigset_t), &block)) {
+ pr_perror("Can't block signals for %d", pid);
+ return -1;
+ }
ret = ptrace(PTRACE_CONT, pid, NULL, NULL);
if (ret) {
pr_perror("Unable to restart the stopped tracee process %d", pid);
diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index f33918de8..69d670be9 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -24,14 +24,6 @@ enum faults {
static inline bool __fault_injected(enum faults f, enum faults fi_strategy)
{
- /*
- * Temporary workaround for Xen guests. Breakpoints degrade
- * performance linearly, so until we find out the reason,
- * let's disable them.
- */
- if (f == FI_NO_BREAKPOINTS)
- return true;
-
return fi_strategy == f;
}