about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-07-22 23:48:22 -0400
committerUlrich Drepper <drepper@gmail.com>2011-07-22 23:48:22 -0400
commit7a03a9c8c4b37b88ac5e82b557d974f3161ddaf9 (patch)
treeac6cd11bb65c88e0c69ef331558d33349bce15a5
parent1aae088a8aa2a4e4211bfe6c0e18100d85f106ae (diff)
downloadglibc-7a03a9c8c4b37b88ac5e82b557d974f3161ddaf9.tar.gz
glibc-7a03a9c8c4b37b88ac5e82b557d974f3161ddaf9.tar.xz
glibc-7a03a9c8c4b37b88ac5e82b557d974f3161ddaf9.zip
Add read barriers in cancellation initialization
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/sysdeps/pthread/unwind-forcedunwind.c14
2 files changed, 19 insertions, 3 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 2acc676fd8..5920800a9f 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2011-07-22  Ulrich Drepper  <drepper@gmail.com>
+
+	* sysdeps/pthread/unwind-forcedunwind.c (_Unwind_Resume): Add read
+	barrier.
+	(__gcc_personality_v0): Likewise.
+	(_Unwind_ForcedUnwind): Likewise.
+	(_Unwind_GetCFA): Likewise.
+
 2011-07-14  Roland McGrath  <roland@hack.frob.com>
 
 	* allocatestack.c (__reclaim_stacks): Use uintptr_t cast rather than
diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c
index ae43f335e7..3b27827c6b 100644
--- a/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
@@ -96,6 +96,8 @@ _Unwind_Resume (struct _Unwind_Exception *exc)
 {
   if (__builtin_expect (libgcc_s_handle == NULL, 0))
     pthread_cancel_init ();
+  else
+    atomic_read_barrier ();
 
   void (*resume) (struct _Unwind_Exception *exc) = libgcc_s_resume;
   PTR_DEMANGLE (resume);
@@ -105,11 +107,13 @@ _Unwind_Resume (struct _Unwind_Exception *exc)
 _Unwind_Reason_Code
 __gcc_personality_v0 (int version, _Unwind_Action actions,
 		      _Unwind_Exception_Class exception_class,
-                      struct _Unwind_Exception *ue_header,
-                      struct _Unwind_Context *context)
+		      struct _Unwind_Exception *ue_header,
+		      struct _Unwind_Context *context)
 {
   if (__builtin_expect (libgcc_s_handle == NULL, 0))
     pthread_cancel_init ();
+  else
+    atomic_read_barrier ();
 
   _Unwind_Reason_Code (*personality)
     (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
@@ -124,6 +128,8 @@ _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,
 {
   if (__builtin_expect (libgcc_s_handle == NULL, 0))
     pthread_cancel_init ();
+  else
+    atomic_read_barrier ();
 
   _Unwind_Reason_Code (*forcedunwind)
     (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *)
@@ -137,6 +143,8 @@ _Unwind_GetCFA (struct _Unwind_Context *context)
 {
   if (__builtin_expect (libgcc_s_handle == NULL, 0))
     pthread_cancel_init ();
+  else
+    atomic_read_barrier ();
 
   _Unwind_Word (*getcfa) (struct _Unwind_Context *) = libgcc_s_getcfa;
   PTR_DEMANGLE (getcfa);