]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_file_cache: Fix crashes for mmap'ed files under threaded MPM.
authorJoe Orton <jorton@apache.org>
Tue, 16 Dec 2025 16:05:10 +0000 (16:05 +0000)
committerJoe Orton <jorton@apache.org>
Tue, 16 Dec 2025 16:05:10 +0000 (16:05 +0000)
* modules/cache/mod_file_cache.c (mmap_handler): fix file getting
  unmapped erroneously when server is under load in multi-thread
  multi-core configuration

PR: 69901
Submitted by: barr.israel <barr.israel campus.technion.ac.il>
Github: closes #582

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1930632 13f79535-47bb-0310-9956-ffa450edef68

changes-entries/pr69901.txt [new file with mode: 0644]
modules/cache/mod_file_cache.c

diff --git a/changes-entries/pr69901.txt b/changes-entries/pr69901.txt
new file mode 100644 (file)
index 0000000..4b80e5c
--- /dev/null
@@ -0,0 +1,3 @@
+  *) mod_file_cache: Fix crashes for mmap'ed files under threaded
+     MPMs. PR 69901. barr.israel <barr.israel campus.technion.ac.il>
+
index ce1db2d2c9347d622e59c468f9b712abbe6c57bd..51a53a7509c5b6b35476e397677f6a045f7d5db9 100644 (file)
@@ -275,9 +275,8 @@ static int mmap_handler(request_rec *r, a_file *file)
     apr_mmap_t *mm;
     apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);
 
-    apr_mmap_dup(&mm, file->mm, r->pool);
-    b = apr_bucket_mmap_create(mm, 0, (apr_size_t)file->finfo.size,
-                               c->bucket_alloc);
+    b = apr_bucket_immortal_create((const char *)file->mm->mm,
+                                  (apr_size_t)file->finfo.size, c->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(bb, b);
     b = apr_bucket_eos_create(c->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(bb, b);