php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16492 php_passthru_fd() which uses mmap() crashes machine
Submitted: 2002-04-08 08:24 UTC Modified: 2002-04-09 05:35 UTC
From: fuf at mobil dot cz Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.1.2 OS: linux 2.2.x, 2.4.x
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fuf at mobil dot cz
New email:
PHP Version: OS:

 

 [2002-04-08 08:24 UTC] fuf at mobil dot cz
hello,

short:
function fd_passthru_fd() which uses the mmap() function to read a file contents crashes the whole machine after 2 days of heavy use. with #undef HAVE_MMAP the machine is rock solid.

long:
we have a dual cpu download server that uses apache and a php script to control access to files. the script first checks whether the user is allowed to download a desired file and then sends it to the user with the use of function readfile().

however with HAVE_MMAP = 1 and thus a different code in php_passthru_fd() the server crashed repeatedly with this kernel message:
Oops: 0000
CPU:    1
EIP:    0010:[kmem_cache_free+64/436]
EFLAGS: 00010086
eax: d7fff020   ebx: d7fff020   ecx: 7dd3035c   edx: cd76e95c
esi: cd76e920   edi: 00000292   ebp: d7fff260   esp: d7fe1f1c
ds: 0018   es: 0018   ss: 0018
Process kswapd (pid: 4, process nr: 5, stackpage=d7fe1000)
Stack: ce32c000 d7fff260 00000000 c036e6e0 c0100018 00000202 ffffff09 c0126dda
       00000010 c0125cdc d7fff020 cd76e920 d7fe0000 c0125cc7 d7fe0000 00000020
       d7fe02c5 00000030 c036e3e8 c0120bff 00000010 d7fff268 c0266fc0 00000000
Call Trace: [startup_32+24/169] [__free_pages+282/356] [kmem_cache_reap+684/744] [kmem_cache_reap+663/744] [
shrink_mmap+139/476] [try_to_free_pages+108/260] [tvecs+6062/13120]
       [tvecs+6062/13120] [kswapd+106/160] [kswapd+82/160] [kernel_thread+31/56] [kernel_thread+40/56]
Code: 8b 41 08 3d 2b 2f c3 a5 0f 85 ee 00 00 00 8b 41 0c 85 c0 74

after having #undef'ed HAVE_MMAP the machine runs all okay (even under much heavier load). i'm not sure whether this is a php or kernel related bug, but i guess you'd be interested.

thanks,
            Michal Vitecek

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-08 11:04 UTC] fuf at mobil dot cz
just another important note: the server crashes occured only after it'd been running for 2 days (not sooner). during that time we noticed much heavier memory usage (swap was used and the memory used in buffers (cached) was just 1MB below the physical memory, now the swap is not used at all and memory used in buffers is ~100MB below the physical memory).

also the crashes occured independently of kernel version. we tried 2.2.17-18 and 2.4.18.

thanks,
        Michal Vitecek
 [2002-04-08 12:13 UTC] wez@php.net
It's a kernel bug; there is no way that PHP can cause an
oops.

--> Bogus

(Try a more stable kernel!)
 [2002-04-09 04:34 UTC] fuf at mobil dot cz
well, it _is_ a kernel bug, but maybe it's triggered by some incorrect use of mmap() in php. and if the use of mmap() is correct in php, then imo the linux kernel developers should be notified about this problem, because there are no more stable kernels than 2.2.17-20 and 2.4.18.

just my opinion.
 [2002-04-09 05:35 UTC] wez@php.net
PHP, running in user-space cannot be causing a problem
in kernel-space, unless there is a bug in the kernel.

By all means, report that there is a problem with mmap
in the linux kernel.
It is not PHP's problem; I've been running on 2.2.16-SMP
with absolutely no sign of mmap related problems, ever!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC