httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Stoddard <b...@wstoddard.com>
Subject [PATCH] Fix segfault serving mod_file_cache'ed files
Date Thu, 23 Jan 2003 16:05:41 GMT
This patch fixes a segfault I see serving files cached by MMapFile. 
 First request is okay, subsequent request  segfaults in an mmap ring 
macro during apr_brigade_destroy because the next pointer is null.. I 
did not spend time trying to figure out exactly why the next pointer was 
null, but looking at the code, it seemed quite bogus that we were 
placing an apr_mmap_t allocated out of the cmd pool into the brigade.

BTW, I am +1 on merging Cliff's mod_file_cache patch to the cleanups 
into APACHE_2_0_BRANCH. It looks correct to me.

Bill

Index: mod_file_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/cache/mod_file_cache.c,v
retrieving revision 1.73.2.1
diff -u -r1.73.2.1 mod_file_cache.c
--- mod_file_cache.c    22 Jan 2003 05:22:42 -0000    1.73.2.1
+++ mod_file_cache.c    23 Jan 2003 15:54:57 -0000
@@ -349,9 +320,11 @@
 #if APR_HAS_MMAP
     conn_rec *c = r->connection;
     apr_bucket *b;
+    apr_mmap_t *mm;
     apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);
 
-    b = apr_bucket_mmap_create(file->mm, 0, (apr_size_t)file->finfo.size,
+    apr_mmap_dup(&mm, file->mm, r->pool, 0);
+    b = apr_bucket_mmap_create(mm, 0, (apr_size_t)file->finfo.size,
                                c->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(bb, b);
     b = apr_bucket_eos_create(c->bucket_alloc);


Mime
View raw message