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

Cyrill Gorcunov gorcunov at openvz.org
Thu Aug 9 13:36:06 EDT 2012


On Thu, Aug 09, 2012 at 08:29:38PM +0400, Cyrill Gorcunov wrote:
> Note the proto file has been extended.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---

Updated version attached
-------------- next part --------------
>From 65aa39955b321ad7f8992c0d489cae6c268aa315 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Sun, 5 Aug 2012 12:41:54 +0400
Subject: [PATCH 2/4] dump: Add futex robust list dumping v2

Note the proto file has been extended
with optional elements.

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

diff --git a/cr-dump.c b/cr-dump.c
index 45890b1..13bbdb6 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -565,6 +565,26 @@ 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->has_futex_rla	= true;
+	info->futex_rla		= (u64)head;
+	info->has_futex_rla_len	= true;
+	info->futex_rla_len	= (u32)len;
+
+	return 0;
+}
+
 static int get_task_personality(pid_t pid, u32 *personality)
 {
 	FILE *file = NULL;
@@ -847,6 +867,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;
@@ -1233,6 +1257,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..c44419a 100644
--- a/protobuf/core.proto
+++ b/protobuf/core.proto
@@ -64,6 +64,9 @@ message thread_info_x86 {
 	required uint64			clear_tid_addr	= 1;
 	required user_x86_regs_entry	gpregs		= 2;
 	required user_x86_fpregs_entry	fpregs		= 3;
+
+	optional uint64			futex_rla	= 4;
+	optional uint32			futex_rla_len	= 5;
 }
 
 message core_entry {
-- 
1.7.7.6



More information about the CRIU mailing list