[SCM] Samba Shared Repository - branch v3-6-test updated
Volker Lendecke
vlendec at samba.org
Fri Sep 24 18:21:57 MDT 2010
The branch, v3-6-test has been updated
via 464666b talloc: Add a warning about talloc_autofree_context() and dlclose()
from 9788a68 s3-krb5 Fix Kerberos on FreeBSD with Samba4 DCs
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit 464666b6c4149cd9003bdb3f425b46df07154156
Author: Volker Lendecke <vl at samba.org>
Date: Fri Sep 24 19:20:06 2010 +0200
talloc: Add a warning about talloc_autofree_context() and dlclose()
-----------------------------------------------------------------------
Summary of changes:
lib/talloc/talloc.h | 9 +++++++++
lib/talloc/talloc_guide.txt | 13 +++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index c59fd35..0c281cc 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -961,6 +961,15 @@ int talloc_unlink(const void *context, void *ptr);
* which will be automatically freed on program exit. This can be used
* to reduce the noise in memory leak reports.
*
+ * Never use this in code that might be used in objects loaded with
+ * dlopen and unloaded with dlclose. talloc_autofree_context()
+ * internally uses atexit(3). Some platforms like modern Linux handles
+ * this fine, but for example FreeBSD does not deal well with dlopen()
+ * and atexit() used simultaneously: dlclose() does not clean up the
+ * list of atexit-handlers, so when the program exits the code that
+ * was registered from within talloc_autofree_context() is gone, the
+ * program crashes at exit.
+ *
* @return A talloc context, NULL on error.
*/
void *talloc_autofree_context(void);
diff --git a/lib/talloc/talloc_guide.txt b/lib/talloc/talloc_guide.txt
index 79387bf..d50aa93 100644
--- a/lib/talloc/talloc_guide.txt
+++ b/lib/talloc/talloc_guide.txt
@@ -74,6 +74,19 @@ without proper synchronization ;
shouldn't be used by several threads simultaneously without
synchronization.
+talloc and shared objects
+-------------------------
+
+talloc can be used in shared objects. Special care needs to be taken
+to never use talloc_autofree_context() in code that might be loaded
+with dlopen() and unloaded with dlclose(), as talloc_autofree_context()
+internally uses atexit(3). Some platforms like modern Linux handles
+this fine, but for example FreeBSD does not deal well with dlopen()
+and atexit() used simultaneously: dlclose() does not clean up the list
+of atexit-handlers, so when the program exits the code that was
+registered from within talloc_autofree_context() is gone, the program
+crashes at exit.
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(type *)talloc(const void *context, type);
--
Samba Shared Repository
More information about the samba-cvs
mailing list