]> granicus.if.org Git - strace/commitdiff
x86-64: fix clone(2) argument order for x86 processes
authorElliott Hughes <enh@google.com>
Sat, 5 Apr 2014 18:56:17 +0000 (11:56 -0700)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 9 Apr 2014 12:33:12 +0000 (12:33 +0000)
Without this patch, strace claims that parent_tidptr == tls, which is
clearly wrong.  It is expected that parent_tidptr == child_tidptr.

* process.c [X86_64] (ARG_CTID, ARG_TLS): Take current
personality into account.

Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
process.c

index e3837daf3126228100466baa9033bdcb47fa7a1e..442f00173936ac335a9868f73ba8a9dd2e1816bd 100644 (file)
--- a/process.c
+++ b/process.c
@@ -512,8 +512,14 @@ extern void print_ldt_entry();
 # define ARG_PTID      2
 # define ARG_CTID      3
 # define ARG_TLS       4
-#elif defined X86_64 || defined X32 || defined ALPHA || defined TILE \
-   || defined OR1K
+#elif defined X86_64
+/* x86 personality processes have the last two arguments flipped. */
+# define ARG_FLAGS     0
+# define ARG_STACK     1
+# define ARG_PTID      2
+# define ARG_CTID      ((current_personality != 1) ? 3 : 4)
+# define ARG_TLS       ((current_personality != 1) ? 4 : 3)
+#elif defined X32 || defined ALPHA || defined TILE || defined OR1K
 # define ARG_FLAGS     0
 # define ARG_STACK     1
 # define ARG_PTID      2