From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Add write barrier into pthread_cancel_init
Date: Wed, 16 Nov 2005 23:19:00 -0000 [thread overview]
Message-ID: <20051116231843.GL16723@sunsite.mff.cuni.cz> (raw)
Hi!
If the compiler and/or processor reorders the writes to libgcc_s_*
variables in pthread_cancel_init, pthread_cancel_init might return early
if libgcc_s_getcfa has been already written, but some other libgcc_s_*
pointer the caller is actually interested in has not been written yet.
2005-11-17 Jakub Jelinek <jakub@redhat.com>
* sysdeps/pthread/unwind-forcedunwind.c (pthread_cancel_init): Put
a write barrier before writing libgcc_s_getcfa.
--- libc/nptl/sysdeps/pthread/unwind-forcedunwind.c.jj 2003-09-04 07:41:57.000000000 +0200
+++ libc/nptl/sysdeps/pthread/unwind-forcedunwind.c 2005-11-17 00:13:37.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>.
@@ -56,6 +56,10 @@ pthread_cancel_init (void)
libgcc_s_resume = resume;
libgcc_s_personality = personality;
libgcc_s_forcedunwind = forcedunwind;
+ /* Make sure libgcc_s_getcfa is written last. Otherwise,
+ pthread_cancel_init might return early even when the pointer the
+ caller is interested in is not initialized yet. */
+ atomic_write_barrier ();
libgcc_s_getcfa = getcfa;
}
Jakub
reply other threads:[~2005-11-16 23:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051116231843.GL16723@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).