php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53820 segfault in libclntsh.so when using shared oci8 extension
Submitted: 2011-01-23 08:52 UTC Modified: 2011-11-08 00:54 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: wxianda at gmail dot com Assigned: sixd (profile)
Status: Suspended Package: OCI8 related
PHP Version: 5.3.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wxianda at gmail dot com
New email:
PHP Version: OS:

 

 [2011-01-23 08:52 UTC] wxianda at gmail dot com
Description:
------------
use the latest php 5.3.5, tested in:
gcc 4.4.5, ubuntu 10.10 x86, oracle express;
gcc ???, asia linux 2(same as RHEL5?) x86, oracle 10g R2;
gcc ???, centos 4.5 x86, oracle 10g R1.

./configure --disable-all --disable-cgi --without-pear --with-
oci8=shared,$ORACLE_HOME
make

php.ini:
extension_dir = "./modules"
extension = oci8.so
oci8.privileged_connect = On

environment variable ORACLE_HOME and ORACLE_SID are both correct.

when using NULL as connection_string in oci_connect() to connect to oracle:
sapi/cli/php -c php.ini -r "oci_internal_debug(TRUE); 
var_dump(oci_connect('sys', 'sys', NULL, NULL, OCI_SYSDBA));"

it crashes:
OCI8 DEBUG: OCIHandleAlloc at (/home/xianda/php-5.3.5.orig/ext/oci8/oci8.c:1067)
OCI8 DEBUG: OCIConnectionPoolCreate at (/home/xianda/php-
5.3.5.orig/ext/oci8/oci8.c:1068)
OCI8 DEBUG: OCIConnectionPoolDestroy at (/home/xianda/php-
5.3.5.orig/ext/oci8/oci8.c:1069)
OCI8 DEBUG: OCIHandleFree at (/home/xianda/php-5.3.5.orig/ext/oci8/oci8.c:1070)
OCI8 DEBUG: OCINlsEnvironmentVariableGet at (/home/xianda/php-
5.3.5.orig/ext/oci8/oci8.c:1826)
OCI8 DEBUG L1: Got NO cached connection at (/home/xianda/php-
5.3.5.orig/ext/oci8/oci8.c:1871)
OCI8 DEBUG: Bypassing client-side session pool for session create at 
(/home/xianda/php-5.3.5.orig/ext/oci8/oci8.c:2833)
OCI8 DEBUG: OCIEnvNlsCreate at (/home/xianda/php-
5.3.5.orig/ext/oci8/oci8.c:2810)
OCI8 DEBUG: OCIHandleAlloc at (/home/xianda/php-5.3.5.orig/ext/oci8/oci8.c:2842)
OCI8 DEBUG: OCIServerAttach at (/home/xianda/php-
5.3.5.orig/ext/oci8/oci8.c:2850)
Segmentation fault

and the call stack shows that it crashes inside the libclntsh.so.

But if I provide a value for connection_string in oci_connect(), it works fine, 
and the call stack in the libclntsh.so is different.

And I try to build php using oci8 as a "static" extension(--oci8=$ORACLE_HOME), 
it also works fine when setting connection_string to NULL(this proves that my 
ORACLE_HOME and ORACLE_SID are correct).

And I test this in the previous three platforms, it acts the same. And I also 
try to use the latest instant client 10 and 11, the same results come out. So I 
believe that it can be easily reproduced in most or all platforms.

So is it the bug of php or oracle's client library???


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-23 08:54 UTC] wxianda at gmail dot com
-Summary: segfault in liclntsh.so when using shared oci8 extension +Summary: segfault in libclntsh.so when using shared oci8 extension
 [2011-01-23 08:54 UTC] wxianda at gmail dot com
sorry i type something wrong in the summary so i have to make an update
 [2011-01-23 09:14 UTC] wxianda at gmail dot com
And I try to use LD_PRELOAD to preload the libclntsh.so at program starting, and 
it works just fine:

$ LD_PRELOAD=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so 
sapi/cli/php -c php.ini -r "var_dump(oci_connect('sys', 'sys', NULL, NULL, 
OCI_SYSDBA));"
resource(4) of type (oci8 connection)

so it seems that the crash is caused by "symbol resolution"???
 [2011-01-23 10:47 UTC] wxianda at gmail dot com
i try to disable the RTLD_DEEPBIND in Zend/zend.h and then make a build, and it 
also works fine.
 [2011-01-24 19:30 UTC] sixd@php.net
-Assigned To: +Assigned To: sixd
 [2011-11-08 00:54 UTC] sixd@php.net
Thanks for the analysis.  I've logged an Oracle bug to track this: 13357270.

I could reproduce the crash in one older 32 bit environment but could not 
reproduce it with Oracle 11.2.0.2 or 11.2.0.3 on 64 bit Oracle Linux 5.7.
 [2011-11-08 00:54 UTC] sixd@php.net
-Status: Assigned +Status: Suspended
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 22 10:01:24 2020 UTC