You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2012/02/24 21:47:01 UTC

svn commit: r1293408 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/httpd.h server/util_debug.c

Author: sf
Date: Fri Feb 24 20:47:01 2012
New Revision: 1293408

URL: http://svn.apache.org/viewvc?rev=1293408&view=rev
Log:
In maintainer mode, replace apr_palloc with a version that
initializes the allocated memory with non-zero values, except if
AP_DEBUG_NO_ALLOC_POISON is defined.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/httpd.h
    httpd/httpd/trunk/server/util_debug.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1293408&r1=1293407&r2=1293408&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Feb 24 20:47:01 2012
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: In maintainer mode, replace apr_palloc with a version that
+     initializes the allocated memory with non-zero values, except if
+     AP_DEBUG_NO_ALLOC_POISON is defined.
+
   *) mod_log_config: Check during config test that directories for access logs
      exist. PR 29941. [Stefan Fritsch]
 

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1293408&r1=1293407&r2=1293408&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Fri Feb 24 20:47:01 2012
@@ -393,6 +393,7 @@
  * 20120204.0 (2.5.0-dev)  Remove ap_create_core_ctx(), ap_core_ctx_get_bb();
  *                         add insert_network_bucket hook, AP_DECLINED
  * 20120211.0 (2.5.0-dev)  Change re_nsub in ap_regex_t from apr_size_t to int.
+ * 20120211.0 (2.5.0-dev)  Add ap_palloc_debug, ap_pcalloc_debug
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -400,7 +401,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20120211
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 0                   /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 1                   /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?rev=1293408&r1=1293407&r2=1293408&view=diff
==============================================================================
--- httpd/httpd/trunk/include/httpd.h (original)
+++ httpd/httpd/trunk/include/httpd.h Fri Feb 24 20:47:01 2012
@@ -2068,6 +2068,8 @@ AP_DECLARE(char *) ap_strrchr(char *s, i
 AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
 AP_DECLARE(char *) ap_strstr(char *s, const char *c);
 AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
+AP_DECLARE(void *) ap_palloc_debug(apr_pool_t *p, apr_size_t size);
+AP_DECLARE(void *) ap_pcalloc_debug(apr_pool_t *p, apr_size_t size);
 
 #ifdef AP_DEBUG
 
@@ -2078,6 +2080,21 @@ AP_DECLARE(const char *) ap_strstr_c(con
 #undef strstr
 # define strstr(s, c)  ap_strstr(s,c)
 
+#ifndef AP_DEBUG_NO_ALLOC_POISON
+/*
+ * ap_palloc_debug initializes allocated memory to non-zero
+ */
+#define apr_palloc     ap_palloc_debug
+/*
+ * this is necessary to avoid useless double memset of memory
+ * with ap_palloc_debug
+ */
+#ifdef apr_pcalloc
+#undef apr_pcalloc
+#endif
+#define apr_pcalloc    ap_pcalloc_debug
+#endif
+
 #else
 
 /** use this instead of strchr */

Modified: httpd/httpd/trunk/server/util_debug.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_debug.c?rev=1293408&r1=1293407&r2=1293408&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_debug.c (original)
+++ httpd/httpd/trunk/server/util_debug.c Fri Feb 24 20:47:01 2012
@@ -223,3 +223,20 @@ AP_DECLARE(void) ap_set_core_module_conf
 {
     ((void **)cv)[AP_CORE_MODULE_INDEX] = val;
 }
+
+#if defined(apr_palloc)
+#undef apr_palloc
+#endif
+AP_DECLARE(void *) ap_palloc_debug(apr_pool_t *p, apr_size_t size)
+{
+    /* poison uninitialized memory */
+    return memset(apr_palloc(p, size), 0xEE, size);
+}
+
+#if defined(apr_pcalloc)
+#undef apr_pcalloc
+#endif
+AP_DECLARE(void *) ap_pcalloc_debug(apr_pool_t *p, apr_size_t size)
+{
+    return memset(apr_palloc(p, size), 0, size);
+}