[CRIU] [PATCH 2/3] dump: Add futex robust list dumping

Cyrill Gorcunov gorcunov at openvz.org
Sun Aug 5 05:12:48 EDT 2012


Note the proto file has been extended.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-dump.c           |   26 ++++++++++++++++++++++++++
 protobuf/core.proto |    9 +++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 3d9d30d..07455c6 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -562,6 +562,24 @@ out:
 	return ret;
 }
 
+static int get_task_futex_robust_list(pid_t pid, ThreadInfoX86 *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;
@@ -844,6 +862,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_info);
+	if (ret)
+		goto err_free;
+
 	ret = get_task_personality(pid, &core->tc->personality);
 	if (ret)
 		goto err_free;
@@ -1230,6 +1252,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_info);
+	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..e985eba 100644
--- a/protobuf/core.proto
+++ b/protobuf/core.proto
@@ -60,10 +60,19 @@ message task_kobj_ids_entry {
 	required uint32			sighand_id	= 4;
 }
 
+message futex_robust_list {
+	required uint64			next		= 1;
+	required uint64			futex_offset	= 2;
+	required uint64			list_op_pending	= 3;
+}
+
 message thread_info_x86 {
 	required uint64			clear_tid_addr	= 1;
 	required user_x86_regs_entry	gpregs		= 2;
 	required user_x86_fpregs_entry	fpregs		= 3;
+
+	required uint64			futex_rla	= 4;
+	required uint32			futex_rla_len	= 5;
 }
 
 message core_entry {
-- 
1.7.7.6



More information about the CRIU mailing list