php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42650 httpd segfaults when odbc_pconnect called with incorrect username/password
Submitted: 2007-09-13 03:59 UTC Modified: 2007-09-26 01:00 UTC
From: gordonthree at gmail dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 5CVS-2007-09-13 (CVS) OS: Centos 5
Private report: No CVE-ID: None
 [2007-09-13 03:59 UTC] gordonthree at gmail dot com
Description:
------------
When attempting to connect to an odbc data source via odbc_pconnect with incorrect username and/or password, the httpd (apache) instance handling that connection segfaults.

OS is Centos 5 (RHEL5) running in a vmware server virtual machine 32 bit

I am using ODBC to connect to a mysql server running on localhost for persistent db connections and mysql stored proc support.

Reproduce code:
---------------
<HTML><BODY>
<?php

$link_id = odbc_pconnect('Default', 'root','badpassword');
    if(!$link_id){die("no connection!");}
    else{echo "connected";}
?>
</BODY></HTML>

Expected result:
----------------
user should see connected printed on web page.

Actual result:
--------------
from httpd/error_log

[Wed Sep 12 23:45:44 2007] [notice] child pid 2233 exit signal Segmentation fault (11)

[root@lampserver1 ~]# gdb http  2232
GNU gdb Red Hat Linux (6.5-16.el5rh)
This GDB was configured as "i386-redhat-linux-gnu"...http: No such file or directory.

Attaching to process 2232
Reading symbols from /usr/sbin/httpd...(no debugging symbols found)...done.
Using host libthread_db library "/lib/libthread_db.so.1".
.
(no debugging symbols found)...done.
Loaded symbols for /etc/httpd/modules/mod_suexec.so
Reading symbols from /usr/lib/httpd/modules/mod_disk_cache.so...(no debugging symbols found)...done.
Loaded symbols for /etc/httpd/modules/mod_disk_cache.so
Reading symbols from /usr/lib/httpd/modules/mod_file_cache.so...
(no debugging symbols found)...done.
Loaded symbols for /etc/httpd/modules/mod_file_cache.so
Reading symbols from /usr/lib/httpd/modules/mod_mem_cache.so...(no debugging symbols found)...done.
Loaded symbols for /etc/httpd/modules/mod_mem_cache.so
Reading symbols from /usr/lib/httpd/modules/mod_cgi.so...
(no debugging symbols found)...done.
Loaded symbols for /etc/httpd/modules/mod_cgi.so
Reading symbols from /usr/lib/httpd/modules/mod_perl.so...(no debugging symbols found)...done.
Loaded symbols for /etc/httpd/modules/mod_perl.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
Reading symbols from /lib/libutil.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libutil.so.1
Reading symbols from /usr/lib/httpd/modules/libphp5.so...
(no debugging symbols found)...done.
Loaded symbols for /etc/httpd/modules/libphp5.so
Reading symbols from /usr/lib/libaspell.so.15...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libaspell.so.15
Reading symbols from /usr/lib/libpspell.so.15...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libpspell.so.15
Reading symbols from /usr/lib/sse2/libgmp.so.3...done.
Loaded symbols for /usr/lib/sse2/libgmp.so.3
Reading symbols from /usr/lib/libcurl.so.3...done.
Loaded symbols for /usr/lib/libcurl.so.3
Reading symbols from /usr/lib/libbz2.so.1...done.
Loaded symbols for /usr/lib/libbz2.so.1
Reading symbols from /usr/lib/libxml2.so.2...done.
Loaded symbols for /usr/lib/libxml2.so.2
Reading symbols from /usr/lib/libidn.so.11...done.
Loaded symbols for /usr/lib/libidn.so.11
Reading symbols from /usr/lib/libstdc++.so.6...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /usr/lib/httpd/modules/mod_python.so...done.
Loaded symbols for /etc/httpd/modules/mod_python.so
Reading symbols from /usr/lib/libpython2.4.so.1.0...done.
Loaded symbols for /usr/lib/libpython2.4.so.1.0
Reading symbols from /usr/lib/httpd/modules/mod_ssl.so...done.
Loaded symbols for /etc/httpd/modules/mod_ssl.so
Reading symbols from /usr/lib/libdistcache.so.1...done.
Loaded symbols for /usr/lib/libdistcache.so.1
Reading symbols from /usr/lib/libnal.so.1...done.
Loaded symbols for /usr/lib/libnal.so.1
Reading symbols from /usr/lib/php/modules/ldap.so...done.
Loaded symbols for /usr/lib/php/modules/ldap.so
Reading symbols from /usr/lib/php/modules/mbstring.so...done.
Loaded symbols for /usr/lib/php/modules/mbstring.so
Reading symbols from /usr/lib/php/modules/mysql.so...done.
Loaded symbols for /usr/lib/php/modules/mysql.so
Reading symbols from /usr/lib/mysql/libmysqlclient.so.15...done.
Loaded symbols for /usr/lib/mysql/libmysqlclient.so.15
Reading symbols from /usr/lib/php/modules/mysqli.so...done.
Loaded symbols for /usr/lib/php/modules/mysqli.so
Reading symbols from /usr/lib/php/modules/odbc.so...done.
Loaded symbols for /usr/lib/php/modules/odbc.so
Reading symbols from /usr/lib/libodbc.so.1...done.
Loaded symbols for /usr/lib/libodbc.so.1
Reading symbols from /usr/lib/libodbcpsql.so.2...done.
Loaded symbols for /usr/lib/libodbcpsql.so.2
Reading symbols from /usr/lib/php/modules/pdo.so...done.
Loaded symbols for /usr/lib/php/modules/pdo.so
Reading symbols from /usr/lib/php/modules/pdo_mysql.so...done.
Loaded symbols for /usr/lib/php/modules/pdo_mysql.so
Reading symbols from /usr/lib/php/modules/pdo_odbc.so...done.
Loaded symbols for /usr/lib/php/modules/pdo_odbc.so
Reading symbols from /usr/lib/php/modules/pdo_sqlite.so...done.
Loaded symbols for /usr/lib/php/modules/pdo_sqlite.so
0x00310402 in __kernel_vsyscall ()
(gdb) where
#0  0x00310402 in __kernel_vsyscall ()
#1  0x004179eb in semop () from /lib/libc.so.6
#2  0x00333dba in apr_os_proc_mutex_put () from /usr/lib/libapr-1.so.0
#3  0x00333392 in apr_proc_mutex_lock () from /usr/lib/libapr-1.so.0
#4  0x00fc56ee in ap_graceful_stop_signalled () from /usr/sbin/httpd
#5  0x00fc5b71 in ap_graceful_stop_signalled () from /usr/sbin/httpd
#6  0x00fc5c4a in ap_graceful_stop_signalled () from /usr/sbin/httpd
#7  0x00fc67ab in ap_mpm_run () from /usr/sbin/httpd
#8  0x00f9d127 in main () from /usr/sbin/httpd

PHP info:
# php -v
PHP 5.1.6 (cli) (built: May  8 2007 19:51:21)

# httpd -V
Server version: Apache/2.2.3
Server built:   Jun 26 2007 19:26:32
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

# cat /etc/odbc.ini
[ODBC Data Sources]
MySQL = MySQL Generic ODBC Driver

[Default]
DRIVER=/usr/lib/libmyodbc5.so
SERVER=localhost
DATABASE=ulogdb
UID=
PWD=
PORT=3306

# mysql -V
mysql  Ver 14.12 Distrib 5.0.22, for redhat-linux-gnu (i686) using readline 5.0


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-13 04:03 UTC] gordonthree at gmail dot com
sorry, it looks like the trace I provided was not for the worker that actually died.  any tips on how to determine what httpd worker thread to attach to, to capture it dieing?
 [2007-09-13 07:57 UTC] jani@php.net
First of all, doesn't it not crash when you use correct username/password? (try search for existing reports about using odbc_pconnect(), there are open bug reports about it crashing already..)
 [2007-09-13 12:24 UTC] gordonthree at gmail dot com
@jani

When a correct username and password is supplied, it works great, no crash.
 [2007-09-18 19:00 UTC] iliaa@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Can you please compile PHP with --enable-debug and try running the 
script on the command line. The backtrace should be much better then the 
one you currently have. From the current backtrace it does not appear 
that the crash is inside PHP.
 [2007-09-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC