From: | Arlene Berry <aberry@likewise.com> |
To: | "krb5-bugs@mit.edu" <krb5-bugs@mit.edu> |
Subject: | segfault when unloading libraries on old O/S |
Date: | Thu, 21 Jul 2011 20:14:53 +0000 |
We've had this in our local source for a long time and it's to prevent a segfault when unloading libraries on RHEL 2.1. I don't know whether anything else needs it. The original description and patch are below.
"There must be a bug in the loader on RHEL 2.1. libcom_err's destructor is sometimes (not always) called before libgssapi_krb5's destructor. This causes libgssapi_krb5 to look at the already freed global table.
The fix is to NULL out et_list once it is freed, so that even if libgssapi_krb5's destructor is called afterwards, it will not look at the list."
Index: src/util/et/error_message.c
===================================================================
--- src/util/et/error_message.c (revision 25023)
+++ src/util/et/error_message.c (working copy)
@@ -81,6 +81,7 @@
enext = e->next;
free(e);
}
+ et_list = NULL;
k5_mutex_unlock(&et_list_lock);
k5_mutex_destroy(&et_list_lock);
terminated = 1;
"There must be a bug in the loader on RHEL 2.1. libcom_err's destructor is sometimes (not always) called before libgssapi_krb5's destructor. This causes libgssapi_krb5 to look at the already freed global table.
The fix is to NULL out et_list once it is freed, so that even if libgssapi_krb5's destructor is called afterwards, it will not look at the list."
Index: src/util/et/error_message.c
===================================================================
--- src/util/et/error_message.c (revision 25023)
+++ src/util/et/error_message.c (working copy)
@@ -81,6 +81,7 @@
enext = e->next;
free(e);
}
+ et_list = NULL;
k5_mutex_unlock(&et_list_lock);
k5_mutex_destroy(&et_list_lock);
terminated = 1;