[CRIU] [PATCH 1/3] dump: Add futex robust list dumping v3
Cyrill Gorcunov
gorcunov at openvz.org
Fri Aug 10 05:21:17 EDT 2012
This patch introduces ThreadCoreEntry
protobuf structure to c/r futex robust
lists.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-dump.c | 34 ++++++++++++++++++++++++++++++++++
protobuf/core.proto | 6 ++++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index 45890b1..6356c47 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -565,6 +565,24 @@ out:
return ret;
}
+static int get_task_futex_robust_list(pid_t pid, ThreadCoreEntry *info)
+{
+ struct robust_list_head *head = NULL;
+ size_t len = 0;
+ int ret;
+
+ ret = sys_get_robust_list(pid, &head, &len);
+ if (ret) {
+ pr_err("Failed obtaining futex robust list on %d\n", pid);
+ return -1;
+ }
+
+ info->futex_rla = (u64)head;
+ info->futex_rla_len = (u32)len;
+
+ return 0;
+}
+
static int get_task_personality(pid_t pid, u32 *personality)
{
FILE *file = NULL;
@@ -740,6 +758,7 @@ static void core_entry_free(CoreEntry *core)
xfree(core->thread_info->fpregs);
}
xfree(core->thread_info);
+ xfree(core->thread_core);
xfree(core->tc);
xfree(core->ids);
}
@@ -755,6 +774,7 @@ static CoreEntry *core_entry_alloc(int alloc_thread_info,
UserX86FpregsEntry *fpregs;
TaskCoreEntry *tc;
TaskKobjIdsEntry *ids;
+ ThreadCoreEntry *thread_core;
core = xmalloc(sizeof(*core));
if (!core)
@@ -770,6 +790,12 @@ static CoreEntry *core_entry_alloc(int alloc_thread_info,
thread_info_x86__init(thread_info);
core->thread_info = thread_info;
+ thread_core = xmalloc(sizeof(*thread_core));
+ if (!thread_core)
+ goto err;
+ thread_core_entry__init(thread_core);
+ core->thread_core = thread_core;
+
gpregs = xmalloc(sizeof(*gpregs));
if (!gpregs)
goto err;
@@ -847,6 +873,10 @@ static int dump_task_core_all(pid_t pid, const struct proc_pid_stat *stat,
if (ret)
goto err_free;
+ ret = get_task_futex_robust_list(pid, core->thread_core);
+ if (ret)
+ goto err_free;
+
ret = get_task_personality(pid, &core->tc->personality);
if (ret)
goto err_free;
@@ -1233,6 +1263,10 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid)
if (ret)
goto err_free;
+ ret = get_task_futex_robust_list(pid, core->thread_core);
+ if (ret)
+ goto err_free;
+
ret = parasite_dump_thread_seized(parasite_ctl, pid, &taddr, &tid->virt);
if (ret) {
pr_err("Can't dump tid address for pid %d", pid);
diff --git a/protobuf/core.proto b/protobuf/core.proto
index 4fd5753..3e09bdd 100644
--- a/protobuf/core.proto
+++ b/protobuf/core.proto
@@ -66,6 +66,11 @@ message thread_info_x86 {
required user_x86_fpregs_entry fpregs = 3;
}
+message thread_core_entry {
+ required uint64 futex_rla = 1;
+ required uint32 futex_rla_len = 2;
+}
+
message core_entry {
enum march {
UNKNOWN = 0;
@@ -77,4 +82,5 @@ message core_entry {
optional task_core_entry tc = 3;
optional task_kobj_ids_entry ids = 4;
+ optional thread_core_entry thread_core = 5;
}
--
1.7.7.6
More information about the CRIU
mailing list