php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9789 Running mcrypt functions causes segmentation faults
Submitted: 2001-03-16 10:40 UTC Modified: 2001-04-10 12:53 UTC
From: eten at salutia dot com dot ar Assigned: cmv (profile)
Status: Closed Package: mcrypt related
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
 [2001-03-16 10:40 UTC] eten at salutia dot com dot ar
We are using PHP as an Apache module, and are using mcrypt functions in our scripts, and we get segmentation faults. We have submitted queries at a few
forums, and gotten no answer that will help us. This not only happens at the server from which we're delivering logs and other data, but at other servers,
with diferent kernels, apache versions, even diferent distribution versions. We have tried configuring php in many diferent ways, but we keep getting the segmentation faults.

We run: gdb /apache/bin/httpd and at gdb prompt: run -X
and then when we try to browse the php script (included after this gdb log):

--- begin gdb log ---
This GDB was configured as "i386-redhat-linux"...
(gdb) run -X
Starting program: /apache/bin/httpd -X
Program received signal SIGSEGV, Segmentation fault.
0x400fc0b9 in chunk_free (ar_ptr=0x40190d60, p=0xcfdacd2b) at malloc.c:3094
3094    malloc.c: No such file or directory.
(gdb)
(gdb) bt
#0  0x400fc0b9 in chunk_free (ar_ptr=0x40190d60, p=0xcfdacd2b) at
malloc.c:3094
#1  0x400fbfba in __libc_free (mem=0x8120368) at malloc.c:3023
#2  0x402f82a0 in mcrypt_free (ptr=0x8120368) at mcrypt.c:242
#3  0x402047d5 in php_mcrypt_do_crypt (cipher=0x81203a4 "des", key=0x8147c68,
data=0x8147c6c, mode=0x812038c "ecb", iv=0x0,
    argc=4, dencrypt=0, return_value=0x814b584) at mcrypt.c:1258
    #4  0x40204d6d in php_if_mcrypt_encrypt (ht=4, return_value=0x814b584,
    this_ptr=0x0, return_value_used=1) at mcrypt.c:1329
    #5  0x401caaf6 in execute (op_array=0x814b7a4) at ./zend_execute.c:1519
    #6  0x401d8b30 in zend_execute_scripts (type=8, file_count=3) at
    zend.c:729
    #7  0x401e9c41 in php_execute_script (primary_file=0xbffff7e0) at
    main.c:1221
    #8  0x401e6682 in apache_php_module_main (r=0x812fd0c,
    display_source_mode=0) at sapi_apache.c:89
    #9  0x401e6fa3 in send_php (r=0x812fd0c, display_source_mode=0,
    filename=0x0) at mod_php4.c:516
    #10 0x401e6fd4 in send_parsed_php (r=0x812fd0c) at mod_php4.c:527
    #11 0x8076473 in ap_invoke_handler () at md4.c:255
    #12 0x8089f09 in process_request_internal () at md4.c:255
    #13 0x8089f6c in ap_process_request () at md4.c:255
    #14 0x808159e in child_main () at md4.c:255
    #15 0x808172c in make_child () at md4.c:255
    #16 0x8081889 in startup_children () at md4.c:255
    #17 0x8081ec6 in standalone_main () at md4.c:255
    #18 0x8082653 in main () at md4.c:255
    #19 0x400ba9cb in __libc_start_main (main=0x808230c <main>, argc=2,
    argv=0xbffff9a4, init=0x804efe4 <_init>,
        fini=0x80b6c0c <_fini>, rtld_fini=0x4000ae60 <_dl_fini>,
	stack_end=0xbffff99c) at ../sysdeps/generic/libc-start.c:92
	(gdb)
	
--- end gdb log ---

--- begin php script ----
<?
	print(@mcrypt_encrypt(MCRYPT_DES, "12345678",'aaa     ', MCRYPT_MODE_ECB));
	print("\n<br>\n");
?>
--- end php script ---

Here are some other details that we hope might help you.
We're using Red Hat Linux release 6.2 (Zoot), with the default kernel
(2.2.14-5) on an intel processor:
model name      : Pentium III (Coppermine)
stepping        : 3
cpu MHz         : 598.075823

The software we think is involved in causing this problem is:

Apache:
melpomenia:/apache/bin# /apache/bin/httpd -v
Server version: Apache/1.3.17 (Unix)
Server built:   Feb  6 2001 10:25:18

PHP:
php-4.0.4pl1
./configure --enable-bcmath \
--with-db2 --with-apxs=/apache/bin/apxs \
--enable-shmop --with-zlib --enable-track-vars --with-ftp --with-gettext \
--with-mysql --with-gd --with-mcrypt --enable-sysvsem --enable-sysvshm \
--with-mhash --without-xml --disable-xml --enable-debug

LibMcrypt (which is what we suspect is causing the segmentation faults, from the straces we have run, as well as from the fact that we only get segmentation faults when using mcrypt functions in the scripts).
libmcrypt-2.4.4

If you need any additional information, or find that this is not a bug but a
mistake on our part, please contact us at:
eten@salutia.com.ar or hcollazo@salutia.com.ar

Thank you for your wonderful scripting language, we hope we can help you make
it even better :).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-10 12:53 UTC] cmv@php.net
Can you retest with the latest CVS?  This seems to have been fixed (i.e. I can't reproduce it).

If not, re-open this bug report.

- Colin
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 13:01:30 2024 UTC