This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 08/19] nptl: arm: Fix Race conditions in pthread cancellation (BZ#12683)

On 12/12/2017 11:51, Joseph Myers wrote:
> On Tue, 12 Dec 2017, Adhemerval Zanella wrote:
>> So I am not sure we need all the CFI directives to enable cancellation work
>> on ARM (at least current syscall wrappers which use C version of 
>> {INLINE,INTERNAL}_SYSCALL are not generating them).
> The cfi_* on ARM are for debugging, not for cancellation (and so to get 
> corresponding output from the compiler you'd need to compile with -g).  
> ARM uses ".cfi_sections .debug_frame".

Right, I think we can let the compiler generate the correct info in
such cases.  Below there is an updated patch that removes the arch
specific implementation.  I need to adjust the syscall_cancel from
02/19 patch to uses a '%' mark for function symbol declaration
(the version I sent uses a '@' which ARM gas interprets as a inline


This patch adds the ARM modifications required for the BZ#12683.
It basically adds the required ucontext_get_pc function and adjust
the generic syscall_cancel build.

For ARM we need to build syscall_cancel in ARM mode (-marm) to avoid
INTERNAL_SYSCALL to issue the syscall through the helper gate
__libc_do_syscall (which invalidates the mark checks on SIGCANCEL

Checked on arm-linux-gnueabihf.

	* sysdeps/unix/sysv/linux/arm/Makefile (CFLAGS-syscall_cancel.c): New
	* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (ucontext_get_pc):
	New function.

Signed-off-by: Adhemerval Zanella <>
 ChangeLog                                    |  5 +++++
 sysdeps/unix/sysv/linux/arm/Makefile         |  3 +++
 sysdeps/unix/sysv/linux/arm/sigcontextinfo.h | 12 ++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile
index 4adc35d..8f01b52 100644
--- a/sysdeps/unix/sysv/linux/arm/Makefile
+++ b/sysdeps/unix/sysv/linux/arm/Makefile
@@ -30,6 +30,9 @@ endif
 ifeq ($(subdir),nptl)
 libpthread-sysdep_routines += libc-do-syscall
 libpthread-shared-only-routines += libc-do-syscall
+# INLINE_SYSCALL uses the helper __libc_do_syscall in thumb mode.
+CFLAGS-syscall_cancel.c += -marm
 ifeq ($(subdir),resolv)
diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
index d3313af..8132a95 100644
--- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
@@ -16,6 +16,10 @@
    License along with the GNU C Library.  If not, see
    <>.  */
+#include <stdint.h>
 #include <sys/ucontext.h>
 #define SIGCONTEXT siginfo_t *_si, ucontext_t *
@@ -46,3 +50,11 @@
   (act)->sa_flags |= SA_SIGINFO; \
   (sigaction) (sig, act, oact); \
+static inline uintptr_t
+ucontext_get_pc (const ucontext_t *uc)
+  return uc->uc_mcontext.arm_pc;
+#endif /* _SIGCONTEXTINFO_H  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]