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

Cyrill Gorcunov gorcunov at openvz.org
Thu Aug 9 12:29:38 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 |    3 +++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 45890b1..3491f3b 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, 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;
@@ -847,6 +865,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 +1255,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..a463d60 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;
+
+	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