Created
May 28, 2018 16:16
-
-
Save matsumotory/6738834ddfa0c5e8e51f1138028db68a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c | |
index ecc6599..1c60951 100644 | |
--- a/compel/src/lib/infect.c | |
+++ b/compel/src/lib/infect.c | |
@@ -115,6 +115,13 @@ int compel_interrupt_task(int pid) | |
{ | |
int ret; | |
+ ret = ptrace(PTRACE_DETACH, pid, NULL,0); | |
+ if (ret) { | |
+ pr_warn("detached failed : %d (%s)\n", pid, strerror(errno)); | |
+ } else { | |
+ pr_warn("already attached, detached: %d\n", pid); | |
+ } | |
+ | |
ret = ptrace(PTRACE_SEIZE, pid, NULL, 0); | |
if (ret) { | |
/* | |
diff --git a/criu/cr-dump.c b/criu/cr-dump.c | |
index 7ceff4c..b5373ba 100644 | |
--- a/criu/cr-dump.c | |
+++ b/criu/cr-dump.c | |
@@ -728,7 +728,6 @@ static int dump_task_core_all(struct parasite_ctl *ctl, | |
CoreEntry *core = item->core[0]; | |
pid_t pid = item->pid->real; | |
int ret = -1; | |
- struct proc_status_creds *creds; | |
struct parasite_dump_cgroup_args cgroup_args, *info = NULL; | |
BUILD_BUG_ON(sizeof(cgroup_args) < PARASITE_ARG_SIZE_MIN); | |
@@ -741,18 +740,6 @@ static int dump_task_core_all(struct parasite_ctl *ctl, | |
if (ret < 0) | |
goto err; | |
- creds = dmpi(item)->pi_creds; | |
- if (creds->s.seccomp_mode != SECCOMP_MODE_DISABLED) { | |
- pr_info("got seccomp mode %d for %d\n", creds->s.seccomp_mode, vpid(item)); | |
- core->tc->has_seccomp_mode = true; | |
- core->tc->seccomp_mode = creds->s.seccomp_mode; | |
- | |
- if (creds->s.seccomp_mode == SECCOMP_MODE_FILTER) { | |
- core->tc->has_seccomp_filter = true; | |
- core->tc->seccomp_filter = creds->last_filter; | |
- } | |
- } | |
- | |
strlcpy((char *)core->tc->comm, stat->comm, TASK_COMM_LEN); | |
core->tc->flags = stat->flags; | |
core->tc->task_state = item->pid->state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/tracing.c b/src/tracing.c | |
index 51cc0ab..2db0bb2 100644 | |
--- a/src/tracing.c | |
+++ b/src/tracing.c | |
@@ -74,6 +74,8 @@ static int mrb_seccomp_on_tracer_trap(mrb_state *mrb, mrb_value hook, | |
mrb_sys_fail(mrb, "ptrace(PTRACE_GETREGS..."); | |
} | |
+ ptrace(PTRACE_DETACH, child, NULL, NULL); | |
+ | |
mrb_value args[3]; | |
args[0] = mrb_fixnum_value((int)regs.orig_rax); // syscall no | |
args[1] = mrb_fixnum_value((int)child); // pid | |
@@ -148,6 +150,7 @@ static mrb_value mrb_seccomp_start_ptrace(mrb_state *mrb, mrb_value self) { | |
if (mrb_seccomp_on_tracer_trap(mrb, hook, child) < 0) { | |
mrb_raise(mrb, E_RUNTIME_ERROR, "Something is wrong in trap event"); | |
} | |
+ return self; | |
} | |
} | |
} else if (WIFCONTINUED(status)) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment