[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#3691) slapd crashes on 64-bit platforms



Full_Name: Luke Howard
Version: 2.2.26
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (203.13.32.92)


slapd can crash on 64-bit platforms due to a stack overrun.

Patch below (is fixed in HEAD)

===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/include/ldap_pvt_thread.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- include/ldap_pvt_thread.h	2005/03/07 20:02:31	1.43
+++ include/ldap_pvt_thread.h	2005/04/15 04:18:18	1.44
@@ -1,5 +1,5 @@
 /* ldap_pvt_thread.h - ldap threads header file */
-/* $OpenLDAP: include/ldap_pvt_thread.h,v 1.43 2005/03/07 20:02:31 hyc Exp $
*/
+/* $OpenLDAP: include/ldap_pvt_thread.h,v 1.44 2005/04/15 04:18:18 hyc Exp $
*/
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  * 
  * Copyright 1998-2005 The OpenLDAP Foundation.
@@ -44,9 +44,13 @@
 #define LDAP_PVT_THREAD_CREATE_JOINABLE 0
 #define LDAP_PVT_THREAD_CREATE_DETACHED 1
 
+#define	LDAP_PVT_THREAD_SET_STACK_SIZE
 #ifndef LDAP_PVT_THREAD_STACK_SIZE
-	/* LARGE stack */
-#define LDAP_PVT_THREAD_STACK_SIZE	(4*1024*1024)
+	/* LARGE stack. Will be twice as large on 64 bit machine. */
+#define LDAP_PVT_THREAD_STACK_SIZE	( 1 * 1024 * 1024 * sizeof(void *) )
+/* May be explicitly defined to zero to disable it */
+#elif LDAP_PVT_THREAD_STACK_SIZE == 0
+#undef LDAP_PVT_THREAD_SET_STACK_SIZE
 #endif
 
 LDAP_F( int )
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap_r/thr_posix.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- libraries/libldap_r/thr_posix.c	2005/01/01 19:49:45	1.38
+++ libraries/libldap_r/thr_posix.c	2005/04/15 04:18:19	1.39
@@ -1,5 +1,5 @@
 /* thr_posix.c - wrapper around posix and posixish thread implementations.  */
-/* $OpenLDAP: libraries/libldap_r/thr_posix.c,v 1.38 2005/01/01 19:49:45 kurt
Exp $ */
+/* $OpenLDAP: libraries/libldap_r/thr_posix.c,v 1.39 2005/04/15 04:18:19 hyc
Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
  * Copyright 1998-2005 The OpenLDAP Foundation.
@@ -110,7 +110,7 @@
 	pthread_attr_create(&attr);
 #endif
 
-#if defined(LDAP_PVT_THREAD_STACK_SIZE) && LDAP_PVT_THREAD_STACK_SIZE > 0
+#ifdef LDAP_PVT_THREAD_SET_STACK_SIZE
 	/* this should be tunable */
 	pthread_attr_setstacksize( &attr, LDAP_PVT_THREAD_STACK_SIZE );
 #endif