[27373] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Don't finalize libraries in static build

daemon@ATHENA.MIT.EDU (Greg Hudson)
Wed Dec 12 02:31:31 2012

Date: Wed, 12 Dec 2012 02:31:23 -0500
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201212120731.qBC7VNok020358@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/4538146e1452e0966164119cefb0804993ce6bbb
commit 4538146e1452e0966164119cefb0804993ce6bbb
Author: Greg Hudson <ghudson@mit.edu>
Date:   Tue Dec 11 14:36:06 2012 -0500

    Don't finalize libraries in static build
    
    In a build with static libraries, functions tagged with
    __attribute__((destructor)) may be executed in any order, not in a
    topologically sorted order as they are in shared libraries.  This
    could result in libcom_err functions being invoked (from another
    library's finalizer) after libcom_err has been finalized, which would
    (at minimum) result in using a mutex after it is destroyed.  To
    prevent this kind of problem, disable finalizers in the static build
    regardless of whether we have compiler or linker support for them.
    Reported by Mihai Serban <mihai.serban@gmail.com>.

 src/include/k5-platform.h |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index e4c3392..f4021da 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -347,7 +347,19 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
 
 
 
-#if defined(USE_LINKER_FINI_OPTION) || defined(_WIN32)
+#if !defined(SHARED)
+
+/*
+ * In this case, we just don't care about finalization.
+ *
+ * The code will still define the function, but we won't do anything
+ * with it.  Annoying: This may generate unused-function warnings.
+ */
+
+# define MAKE_FINI_FUNCTION(NAME)               \
+        static void NAME(void)
+
+#elif defined(USE_LINKER_FINI_OPTION) || defined(_WIN32)
 /* If we're told the linker option will be used, it doesn't really
    matter what compiler we're using.  Do it the same way
    regardless.  */
@@ -391,16 +403,6 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
 # define MAKE_FINI_FUNCTION(NAME)       \
         static void NAME(void) __attribute__((destructor))
 
-#elif !defined(SHARED)
-
-/* In this case, we just don't care about finalization.
-
-   The code will still define the function, but we won't do anything
-   with it.  Annoying: This may generate unused-function warnings.  */
-
-# define MAKE_FINI_FUNCTION(NAME)       \
-        static void NAME(void)
-
 #else
 
 # error "Don't know how to do unload-time finalization for this configuration."
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post