[CRIU] [PATCH] prctl: add ability to get clear_tid_address

Andrew Vagin avagin at openvz.org
Thu Feb 16 15:31:12 EST 2012


Zero is written at clear_tid_address, when the process exits.
This functionality is used by pthread_join().

sys_set_tid_address() changes this address for current task.

Before this patch clear_tid_address could not be got from user space.
I want to dump a full state of a task, so I need this address.

Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 include/linux/prctl.h |    2 ++
 kernel/sys.c          |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index c620826..5b97d4f 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -120,4 +120,6 @@
 # define PR_SET_MM_AUXV			12
 # define PR_SET_MM_EXE_FILE		13
 
+#define PR_GET_TID_ADDRESS		36
+
 #endif /* _LINUX_PRCTL_H */
diff --git a/kernel/sys.c b/kernel/sys.c
index 0a388c3..6d1dc15 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2084,6 +2084,9 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
 		case PR_SET_MM:
 			error = prctl_set_mm(arg2, arg3, arg4, arg5);
 			break;
+		case PR_GET_TID_ADDRESS:
+			return put_user(me->clear_child_tid,
+						(int __user **)arg2);
 		default:
 			error = -EINVAL;
 			break;
-- 
1.7.1



More information about the CRIU mailing list