diff mbox

[07/13] nptl: x32: Fix Race conditions in pthread cancellation (BZ#12683)

Message ID 1444234995-9542-8-git-send-email-adhemerval.zanella@linaro.com
State New
Headers show

Commit Message

Adhemerval Zanella Netto Oct. 7, 2015, 4:23 p.m. UTC
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>

This patches adds the x32 modification required for the BZ#12683 fix.
It basically adjust the syscall size used to pass the arguments to
the syscall cancel wrappers.

Checked on x32.

	* sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (__syscall_arg_t):
	Define type for x32.
	(__SSC): Add platform specific macro.
---
 ChangeLog                                   |  4 ++++
 sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)
diff mbox

Patch

diff --git a/ChangeLog b/ChangeLog
index 54dfca3..b71c168 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-10-07  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (__syscall_arg_t):
+	Define type for x32.
+	(__SSC): Add platform specific macro.
+
 	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Remove file.
 	* sysdeps/unix/sysv/linux/x86_64/libc-cancellation.S: Remove file.
 	* sysdeps/unix/sysv/linux/x86_64/librt-cancellation.S: Remove file.
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
index 2324168..f2dc8f0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
@@ -18,6 +18,27 @@ 
 #ifndef _LINUX_X32_SYSDEP_H
 #define _LINUX_X32_SYSDEP_H 1
 
+#ifndef __ASSEMBLER__
+#include <libc-internal.h>
+
+typedef long long int __syscall_arg_t;
+
+/* Syscall arguments for x32 follows x86_64 size, however pointers are 32
+   bits in size.  This suppress the GCC warning "cast from pointer to 
+   integer of different size" when calling __syscall_cancel with
+   pointer as arguments.  */
+# define __SSC(__x)						\
+  ({								\
+    __syscall_arg_t __ret;					\
+    DIAG_PUSH_NEEDS_COMMENT;					\
+    DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wpointer-to-int-cast");	\
+    __ret = (sizeof(1 ? (__x) : 0ULL) < 8 ?			\
+      (unsigned long int) (__x) : (long long int) (__x));	\
+    DIAG_POP_NEEDS_COMMENT;					\
+    __ret;							\
+  })
+#endif
+
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/x86_64/sysdep.h>
 #include <sysdeps/x86_64/x32/sysdep.h>