This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 07/13] nptl: x32: Fix Race conditions in pthread cancellation (BZ#12683)
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Cc: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Wed, 7 Oct 2015 13:23:09 -0300
- Subject: [PATCH 07/13] nptl: x32: Fix Race conditions in pthread cancellation (BZ#12683)
- Authentication-results: sourceware.org; auth=none
- References: <1444234995-9542-1-git-send-email-adhemerval dot zanella at linaro dot com>
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 --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>
--
1.9.1