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
path: root/criu
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2022-08-08 02:27:22 +0300
committerAndrei Vagin <avagin@gmail.com>2022-08-15 08:23:49 +0300
commit373281f50dfa9069058aa0bfde05c4f4a40ddd8a (patch)
treeccaf1a767fbb94524bf62394f84a1c24f54228f3 /criu
parent24100795a3de6192cc2e17f15ceccd09145d71a4 (diff)
compel: set TRACESYSGOOD to distinguish breakpoints from syscalls
When delivering system call traps, set bit 7 in the signal number (i.e., deliver SIGTRAP|0x80). This makes it easy for the tracer to distinguish normal traps from those caused by a system call. Signed-off-by: Andrei Vagin <avagin@gmail.com>
Diffstat (limited to 'criu')
-rw-r--r--criu/cr-restore.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 919d10ab5..9a1b23999 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1964,6 +1964,10 @@ static int attach_to_tasks(bool root_seized)
return -1;
}
+ if (ptrace(PTRACE_SETOPTIONS, pid, NULL, PTRACE_O_TRACESYSGOOD)) {
+ pr_perror("Unable to set PTRACE_O_TRACESYSGOOD for %d", pid);
+ return -1;
+ }
/*
* Suspend seccomp if necessary. We need to do this because
* although seccomp is restored at the very end of the
@@ -2028,7 +2032,7 @@ static int restore_rseq_cs(void)
return 0;
}
-static int catch_tasks(bool root_seized, enum trace_flags *flag)
+static int catch_tasks(bool root_seized)
{
struct pstree_item *item;
@@ -2058,7 +2062,7 @@ static int catch_tasks(bool root_seized, enum trace_flags *flag)
return -1;
}
- ret = compel_stop_pie(pid, rsti(item)->breakpoint, flag, fault_injected(FI_NO_BREAKPOINTS));
+ ret = compel_stop_pie(pid, rsti(item)->breakpoint, fault_injected(FI_NO_BREAKPOINTS));
if (ret < 0)
return -1;
}
@@ -2225,7 +2229,6 @@ static void reap_zombies(void)
static int restore_root_task(struct pstree_item *init)
{
- enum trace_flags flag = TRACE_ALL;
int ret, fd, mnt_ns_fd = -1;
int root_seized = 0;
struct pstree_item *item;
@@ -2440,7 +2443,7 @@ skip_ns_bouncing:
timing_stop(TIME_RESTORE);
- if (catch_tasks(root_seized, &flag)) {
+ if (catch_tasks(root_seized)) {
pr_err("Can't catch all tasks\n");
goto out_kill_network_unlocked;
}
@@ -2450,7 +2453,7 @@ skip_ns_bouncing:
__restore_switch_stage(CR_STATE_COMPLETE);
- ret = compel_stop_on_syscall(task_entries->nr_threads, __NR(rt_sigreturn, 0), __NR(rt_sigreturn, 1), flag);
+ ret = compel_stop_on_syscall(task_entries->nr_threads, __NR(rt_sigreturn, 0), __NR(rt_sigreturn, 1));
if (ret) {
pr_err("Can't stop all tasks on rt_sigreturn\n");
goto out_kill_network_unlocked;