8 Replies Latest reply on Feb 11, 2007 4:18 AM by prolancer

    libphp5.so crashes JVM when using <security-constraint>

    prolancer

      I am running a PHP based web application using the following setup:
      - php5servlet-linux-i686-1.0.0-SP1
      - jbossweb-1.0.1.GA-linux2-i686
      - Fedora Core 5 with the latest updates (see next)

      $ uname -a
      Linux pub-srv-001.xxx.xxx.xx 2.6.18-1.2257.fc5 #1 SMP Fri Dec 15 16:07:14 EST 2006 x86_64 x86_64 x86_64 GNU/Linux

      I have installed the application as a web module and have configured the PHP servlet as recommended in the global web.xml file for the jbossweb.sar. The PHP app runs fine and the JBoss WS behaves with the following web.xml file (in the WEB-INF dir for the module):

      <?xml version="1.0" encoding="UTF-8"?>
      
      <web-app id="PlayMe" version="2.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
       <display-name>Play Me</display-name>
      <!--
       Servlet definition is a already done in the global web.xml.
      -->
      <!--
       Welcome file list in the global web.xml already contains index.php.
      -->
      </web-app>


      Then I added a security constraint in the web.xml file

      <?xml version="1.0" encoding="UTF-8"?>
      
      <web-app id="PlayMe" version="2.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
       <display-name>Play Me</display-name>
      <!--
       Servlet definition is a already done in the global web.xml.
      -->
      <!--
       Welcome file list in the global web.xml already contains index.php.
      -->
      <!--
       Protect access to the administration pages.
      -->
       <security-constraint>
       <web-resource-collection>
       <web-resource-name>GameAdministration</web-resource-name>
       <url-pattern>/admin/*</url-pattern>
       </web-resource-collection>
       <auth-constraint>
       <role-name>gameadmin</role-name>
       </auth-constraint>
       <user-data-constraint>
       <transport-guarantee>NONE</transport-guarantee>
       </user-data-constraint>
       </security-constraint>
      
       <security-role>
       <role-name>gameadmin</role-name>
       </security-role>
      
       <login-config>
       <auth-method>DIGEST</auth-method>
       <realm-name>Prolancer Games</realm-name>
       </login-config>
      </web-app>



      The admin directory has PHP pages as well with index.php being the entry page. This is what happens:

      1. I access the .../admin/index.php with IE 7.
      2. A login dialog appears
      3. I supply my user-name and password
      4. The browser starts to display the index.php page but half way through the JVM running the JBoss WS server dies with the following dump

      #
      # An unexpected error has been detected by HotSpot Virtual Machine:
      #
      # SIGSEGV (0xb) at pc=0xc7b4d75d, pid=31890, tid=3358587808
      #
      # Java VM: Java HotSpot(TM) Server VM (1.5.0_09-b03 mixed mode)
      # Problematic frame:
      # C [libphp5.so+0x2e775d] _efree+0x81
      #

      --------------- T H R E A D ---------------

      Current thread (0x0892c1a8): JavaThread "http-pub-srv-001.xxx.xxx.xxx%2F192.xxx.xxx.xxx-80-1" daemon [_thread_in_native, id=31927]

      siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x0000000a

      Registers:
      EAX=0xcb200048, EBX=0xc9791074, ECX=0x00000003, EDX=0x0000000a
      ESP=0xc82fcfe4, EBP=0xc82fcffc, ESI=0xc9a46e28, EDI=0xc7fe26e8
      EIP=0xc7b4d75d, CR2=0x0000000a, EFLAGS=0x00210297

      Top of Stack: (sp=0xc82fcfe4)
      0xc82fcfe4: 00000000 ed8c8700 ee062860 c82fd014
      0xc82fcff4: c7fe26e8 c979abcc c82fdfbc c7b31675
      0xc82fd004: c9791080 00000f9f c7fe26e8 c9a4a1c0
      0xc82fd014: c82fd0f4 f77884f8 08080648 edd3f210
      0xc82fd024: edb072f0 edb072f0 ed5455b0 edb529f0
      0xc82fd034: c82fd064 edd30540 00000000 ed562390
      0xc82fd044: edb529f0 ed5455a8 ed5cb8d8 ee29d020
      0xc82fd054: 00000000 00000000 ed544158 00000000

      Instructions: (pc=0xc7b4d75d)
      0xc7b4d74d: f3 ef c7 8b 54 82 fc 3b 1a 74 03 8b 53 04 8b 03
      0xc7b4d75d: 89 02 8b 13 85 d2 74 06 8b 43 04 89 42 04 83 ec

      Stack: [0xc827f000,0xc8300000), sp=0xc82fcfe4, free space=503k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      C [libphp5.so+0x2e775d] _efree+0x81
      C [libphp5.so+0x2cb675] sapi_deactivate+0x201
      C [libphp5.so+0x2c572f] php_request_shutdown+0x7d7
      C [libphp5servlet.so+0x212f] Java_org_apache_catalina_servlets_php_Handler_php+0x67d
      j org.apache.catalina.servlets.php.Handler.php([BLorg/apache/catalina/servlets/php/ScriptEnvironment;Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)I+0
      j org.apache.catalina.servlets.php.Handler.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+102
      j javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+30
      j org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+354
      j org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+101
      j org.apache.catalina.core.StandardWrapperValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+695
      j org.apache.catalina.core.StandardContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+285
      j org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+342
      j org.apache.catalina.authenticator.AuthenticatorBase.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+675
      j org.jboss.web.tomcat.security.JaccContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+32
      j org.apache.catalina.core.StandardHostValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+64
      j org.apache.catalina.valves.ErrorReportValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+6
      j org.apache.catalina.valves.FastCommonAccessLogValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+6
      j org.apache.catalina.core.StandardEngineValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+42
      j org.apache.catalina.connector.CoyoteAdapter.service(Lorg/apache/coyote/Request;Lorg/apache/coyote/Response;)V+141
      j org.apache.coyote.http11.Http11AprProcessor.process(J)Z+473
      j org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(J)Z+323
      j org.apache.tomcat.util.net.AprEndpoint$Worker.run()V+50
      j java.lang.Thread.run()V+11
      v ~StubRoutines::call_stub
      V [libjvm.so+0x266eec]
      V [libjvm.so+0x42da88]
      V [libjvm.so+0x266745]
      V [libjvm.so+0x2667de]
      V [libjvm.so+0x2ddf75]
      V [libjvm.so+0x4cdb13]
      V [libjvm.so+0x42e698]
      C [libpthread.so.0+0x5433]

      [-- cut -- ]

      I can provide the whole dump if of interest.


      Here is the server log from the time I try and access .../admin/index.php:


      21:53:27,039 DEBUG [AuthenticatorBase] Security checking request GET /playme/admin/
      21:53:27,039 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[WebDAV]' against GET /playme/index.php --> false
      21:53:27,039 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[GameAdministration]' against GET /admin/index.php --> true
      21:53:27,039 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[WebDAV]' against GET /admin/index.php --> false
      21:53:27,039 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[GameAdministration]' against GET /admin/index.php --> true
      21:53:27,039 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
      21:53:27,039 DEBUG [RealmBase] User data constraint has no restrictions
      21:53:27,040 DEBUG [AuthenticatorBase] Calling authenticate()
      21:53:27,040 DEBUG [AuthenticatorBase] Failed authenticate() test
      21:53:31,986 DEBUG [AuthenticatorBase] Security checking request GET /shop/admin/
      21:53:31,986 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[WebDAV]' against GET /playme/index.php --> false
      21:53:31,986 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[GameAdministration]' against GET /admin/index.php --> true
      21:53:31,986 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[WebDAV]' against GET /playme/index.php --> false
      21:53:31,986 DEBUG [RealmBase] Checking constraint 'SecurityConstraint[GameAdministration]' against GET /admin/index.php --> true
      21:53:31,986 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
      21:53:31,986 DEBUG [RealmBase] User data constraint has no restrictions
      21:53:31,986 DEBUG [AuthenticatorBase] Calling authenticate()
      21:53:31,991 DEBUG [WebappClassLoader] findResources(jndi.properties)
      21:53:31,991 DEBUG [WebappClassLoader] loadClass(org.jnp.interfaces.NamingContextFactory, false)
      21:53:31,992 DEBUG [WebappClassLoader] Searching local repositories
      21:53:31,992 DEBUG [WebappClassLoader] findClass(org.jnp.interfaces.NamingContextFactory)
      21:53:31,992 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:31,992 DEBUG [WebappClassLoader] Loading class from parent
      21:53:31,992 DEBUG [WebappClassLoader] loadClass(org.jboss.naming.java.javaURLContextFactory, false)
      21:53:31,992 DEBUG [WebappClassLoader] Searching local repositories
      21:53:31,992 DEBUG [WebappClassLoader] findClass(org.jboss.naming.java.javaURLContextFactory)
      21:53:31,992 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:31,993 DEBUG [WebappClassLoader] Loading class from parent
      21:53:31,993 DEBUG [WebappClassLoader] loadClass(org.jboss.naming.ENCFactory, false)
      21:53:31,994 DEBUG [WebappClassLoader] Searching local repositories
      21:53:31,994 DEBUG [WebappClassLoader] findClass(org.jboss.naming.ENCFactory)
      21:53:31,994 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:31,994 DEBUG [WebappClassLoader] Loading class from parent
      21:53:31,995 DEBUG [WebappClassLoader] loadClass(org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFactory, false)
      21:53:31,995 DEBUG [WebappClassLoader] Searching local repositories
      21:53:31,995 DEBUG [WebappClassLoader] findClass(org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFactory)
      21:53:31,995 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:31,995 DEBUG [WebappClassLoader] Loading class from parent
      21:53:31,998 DEBUG [WebappClassLoader] loadClass(javax.naming.Context, false)
      21:53:32,005 DEBUG [WebappClassLoader] loadClass(java.lang.reflect.Proxy, false)
      21:53:32,006 DEBUG [WebappClassLoader] loadClass(java.lang.Object, false)
      21:53:32,006 DEBUG [WebappClassLoader] loadClass(java.lang.Throwable, false)
      21:53:32,006 DEBUG [WebappClassLoader] loadClass(javax.naming.NamingException, false)
      21:53:32,006 DEBUG [WebappClassLoader] loadClass(java.lang.RuntimeException, false)
      21:53:32,006 DEBUG [WebappClassLoader] loadClass(java.lang.Error, false)
      21:53:32,006 DEBUG [WebappClassLoader] loadClass(java.lang.reflect.UndeclaredThrowableException, false)
      21:53:32,008 DEBUG [WebappClassLoader] loadClass(java.lang.ClassNotFoundException, false)
      21:53:32,008 DEBUG [WebappClassLoader] loadClass(java.lang.NoSuchMethodException, false)
      21:53:32,009 DEBUG [WebappClassLoader] loadClass(java.lang.NoSuchMethodError, false)
      21:53:32,009 DEBUG [WebappClassLoader] loadClass(java.lang.NoClassDefFoundError, false)
      21:53:32,009 DEBUG [WebappClassLoader] loadClass(java.lang.reflect.InvocationHandler, false)
      21:53:32,009 DEBUG [WebappClassLoader] loadClass(java.lang.Class, false)
      21:53:32,009 DEBUG [WebappClassLoader] loadClass(javax.naming.Name, false)
      21:53:32,009 DEBUG [WebappClassLoader] loadClass(java.lang.String, false)
      21:53:32,011 DEBUG [digest] CallbackHandler: org.jboss.security.auth.callback.SecurityAssociationHandler@771eb1
      21:53:32,011 DEBUG [JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@801059
      21:53:32,011 DEBUG [WebappClassLoader] loadClass(org.jboss.security.plugins.JaasSecurityManagerService$DefaultCacheObjectFactory, false)
      21:53:32,011 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,011 DEBUG [WebappClassLoader] findClass(org.jboss.security.plugins.JaasSecurityManagerService$DefaultCacheObjectFactory)
      21:53:32,012 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,012 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,017 DEBUG [digest] CachePolicy set to: org.jboss.util.TimedCachePolicy@dc024a
      21:53:32,017 DEBUG [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@dc024a
      21:53:32,017 DEBUG [JaasSecurityManagerService] Added digest, org.jboss.security.plugins.SecurityDomainContext@1a70b8 to map
      21:53:32,021 DEBUG [WebappClassLoader] loadClass(org.jboss.security.auth.spi.UsersRolesLoginModule, false)
      21:53:32,021 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,021 DEBUG [WebappClassLoader] findClass(org.jboss.security.auth.spi.UsersRolesLoginModule)
      21:53:32,021 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,025 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,031 DEBUG [WebappClassLoader] findResource(defaultUsers.properties)
      21:53:32,032 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,032 DEBUG [WebappClassLoader] findResource(digest-users.properties)
      21:53:32,032 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,032 DEBUG [WebappClassLoader] getResource(defaultUsers.properties)
      21:53:32,032 DEBUG [WebappClassLoader] findResource(defaultUsers.properties)
      21:53:32,032 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,080 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,080 DEBUG [WebappClassLoader] getResource(digest-users.properties)
      21:53:32,080 DEBUG [WebappClassLoader] findResource(digest-users.properties)
      21:53:32,080 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,081 DEBUG [WebappClassLoader] --> Returning 'file:/usr/jboss/jbossweb-1.0.1.GA/server/pub-srv-001/conf/digest-users.properties'
      21:53:32,081 DEBUG [UsersRolesLoginModule] Loaded properties, users=[emil, zane]
      21:53:32,081 DEBUG [WebappClassLoader] findResource(defaultRoles.properties)
      21:53:32,081 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,081 DEBUG [WebappClassLoader] findResource(digest-roles.properties)
      21:53:32,081 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,081 DEBUG [WebappClassLoader] getResource(defaultRoles.properties)
      21:53:32,081 DEBUG [WebappClassLoader] findResource(defaultRoles.properties)
      21:53:32,081 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,082 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,082 DEBUG [WebappClassLoader] getResource(digest-roles.properties)
      21:53:32,082 DEBUG [WebappClassLoader] --> Resource not found, returning null
      21:53:32,083 DEBUG [WebappClassLoader] --> Returning 'file:/usr/jboss/jbossweb-1.0.1.GA/server/pub-srv-001/conf/digest-roles.properties'
      21:53:32,083 DEBUG [UsersRolesLoginModule] Loaded properties, users=[emil, zane]
      21:53:32,084 DEBUG [WebappClassLoader] loadClass(org.jboss.security.auth.spi.RFC2617Digest, false)
      21:53:32,084 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,084 DEBUG [WebappClassLoader] findClass(org.jboss.security.auth.spi.RFC2617Digest)
      21:53:32,084 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,086 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,111 DEBUG [AuthenticatorBase] Authenticated 'emil' with type 'DIGEST'
      21:53:32,111 DEBUG [AuthenticatorBase] Calling accessControl()
      21:53:32,111 DEBUG [RealmBase] Username emil has role gameadmin
      21:53:32,111 DEBUG [AuthenticatorBase] Successfully passed all security constraints
      21:53:32,123 DEBUG [WebappClassLoader] loadClass(org.apache.log4j.Level, false)
      21:53:32,123 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,123 DEBUG [WebappClassLoader] findClass(org.apache.log4j.Level)
      21:53:32,124 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,124 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,124 DEBUG [WebappClassLoader] loadClass(org.apache.log4j.Logger, false)
      21:53:32,124 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,124 DEBUG [WebappClassLoader] findClass(org.apache.log4j.Logger)
      21:53:32,124 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,124 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,124 DEBUG [WebappClassLoader] loadClass(org.apache.log4j.Category, false)
      21:53:32,124 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,124 DEBUG [WebappClassLoader] findClass(org.apache.log4j.Category)
      21:53:32,125 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,125 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,125 DEBUG [WebappClassLoader] loadClass(org.apache.log4j.Priority, false)
      21:53:32,125 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,125 DEBUG [WebappClassLoader] findClass(org.apache.log4j.Priority)
      21:53:32,125 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,125 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,125 DEBUG [WebappClassLoader] loadClass(org.apache.log4j.Level, false)
      21:53:32,125 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,125 DEBUG [WebappClassLoader] findClass(org.apache.log4j.Level)
      21:53:32,126 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,126 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,126 DEBUG [WebappClassLoader] loadClass(org.jboss.logging.XLevel, false)
      21:53:32,126 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,126 DEBUG [WebappClassLoader] findClass(org.jboss.logging.XLevel)
      21:53:32,126 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,126 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,126 DEBUG [WebappClassLoader] loadClass(org.apache.log4j.Logger, false)
      21:53:32,126 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,126 DEBUG [WebappClassLoader] findClass(org.apache.log4j.Logger)
      21:53:32,127 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,127 DEBUG [WebappClassLoader] Loading class from parent
      21:53:32,127 DEBUG [WebappClassLoader] loadClass(org.apache.log4j.Priority, false)
      21:53:32,127 DEBUG [WebappClassLoader] Searching local repositories
      21:53:32,132 DEBUG [WebappClassLoader] findClass(org.apache.log4j.Priority)
      21:53:32,132 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@1144ba2
      21:53:32,133 DEBUG [WebappClassLoader] Loading class from parent
      #
      # An unexpected error has been detected by HotSpot Virtual Machine:
      #
      # SIGSEGV (0xb) at pc=0xc7b4d75d, pid=31890, tid=3358587808
      #
      # Java VM: Java HotSpot(TM) Server VM (1.5.0_09-b03 mixed mode)
      # Problematic frame:
      # C [libphp5.so+0x2e775d] _efree+0x81
      #
      # An error report file with more information is saved as hs_err_pid31890.log
      #
      # If you would like to submit a bug report, please visit:
      # http://java.sun.com/webapps/bugreport/crash.jsp
      #


      I would be grateful for any help with this problem. I can reproduce the problem every time. Just to make sure that it is not the PHP code causing the problem I tried to add the same security constraint to a web module that runs osCommerce (all PHP shop application). The result is exactly the same.

      Thank you,
      Emil


        • 1. Re: libphp5.so crashes JVM when using <security-constraint>
          jfclere

          Could you try to rebuild the php5servlet on your machine.
          svn co https://svn.jboss.org/repos/jbossreflex jbossreflex
          cd jbossreflex/trunk/php
          ant
          that should product a tar.gz to extract in you jbossweb-1.0.1.GA directory.

          • 2. Re: libphp5.so crashes JVM when using <security-constraint>
            prolancer

            Ok, will do. I'll try and do this over the weekend.

            buildphp.sh downloads a lot of source tarballs. Shall I download the source tarballs from the Fedora distribution that I am using rather than the locations specified in buildphp.sh?

            Thank you
            Emil

            • 3. Re: libphp5.so crashes JVM when using <security-constraint>
              prolancer

              No joy.

              I compiled and recompiled; tried different versions of PHP, JBoss Web and Java but the problem is still there. Here are details from the final versions that I tried.

              The problem:

              #
              # An unexpected error has been detected by Java Runtime Environment:
              #
              # SIGSEGV (0xb) at pc=0x00002aaadb14402d, pid=26303, tid=1103386944
              #
              # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.6.0-b105 mixed mode)
              # Problematic frame:
              # C [libphp5.so+0x2bb02d] shutdown_memory_manager+0x6d
              #
              # If you would like to submit a bug report, please visit:
              # http://java.sun.com/webapps/bugreport/crash.jsp
              #
              
              --------------- T H R E A D ---------------
              
              Current thread (0x00002aaad97ce000): JavaThread "http-pub-srv-001.xxx.xxx.xxx%2F192.168.20.2-80-1" daemon [_thread_in_native, id=26331]
              
              siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x0000000000000000
              
              Registers:
              RAX=0x0000000000000000, RBX=0x00000000000000a3, RCX=0x00002aaadbd12180, RDX=0x0000000000000000
              RSP=0x0000000041c43a90, RBP=0x0000000000000005, RSI=0x00002aaadbde59d0, RDI=0x00002aaadbdc4e18
              R8 =0x00002aaadbde59d0, R9 =0x0000000000000000, R10=0x0000000000000000, R11=0x00002aaadb143fc0
              R12=0x0000000000000005, R13=0x00002aaadbd09040, R14=0x00002aaadb56d798, R15=0x00002aaad97ce000
              RIP=0x00002aaadb14402d, EFL=0x0000000000010283, CSGSFS=0x0000000000000033, ERR=0x0000000000000006
               TRAPNO=0x000000000000000e
              
              Top of Stack: (sp=0x0000000041c43a90)
              0x0000000041c43a90: 00002aaadb56d818 00002aaadb56d5a0
              0x0000000041c43aa0: 0000000041c43ae0 00002aaacfe86b40
              0x0000000041c43ab0: 0000000041c43f98 00002aaadb119ba2
              0x0000000041c43ac0: 0100000000000000 00002aaadbd09040
              0x0000000041c43ad0: 0101000000000000 0001010101010101
              0x0000000041c43ae0: 00002aaacfe86b40 a1cfc958bbc0755b
              0x0000000041c43af0: 00002aaacfe87190 00002aaacfe86b40
              0x0000000041c43b00: 0000000041c43f98 00002aaad97ce000
              0x0000000041c43b10: a1cfc958bbc070fb a1cfe3f220b469db
              0x0000000041c43b20: 0000000000000000 0000000000000000
              0x0000000041c43b30: 0000000000000000 0000000000000000
              0x0000000041c43b40: 0000000000000000 0000000000000000
              0x0000000041c43b50: 0000000000000000 0000000000000000
              0x0000000041c43b60: 0000000000000000 0000000000000000
              0x0000000041c43b70: 0000000000000000 0000000000000000
              0x0000000041c43b90: 0000000000000000 0000000000000000
              0x0000000041c43ba0: 0000000000000000 0000000000000000
              0x0000000041c43bb0: 00002aaadbd08af0 0000000041c43e70
              0x0000000041c43bc0: 00002aaacfe87190 00002aaadab02a0a
              0x0000000041c43bd0: 0000000500000000 00002a0000000048
              0x0000000041c43be0: 0000000041c43f80 0000000041c43f88
              0x0000000041c43bf0: 0000000041c43f90 0000000041c43f98
              0x0000000041c43c00: 0000000041c43f30 00002aaad97ce190
              0x0000000041c43c10: 0000000000000000 0000000000000000
              0x0000000041c43c20: 00002aaaaba65d20 0000000041000000
              0x0000000041c43c30: 0000000041c43be0 0000000000000000
              0x0000000041c43c40: 0000000000000000 0000000000000000
              0x0000000041c43c50: 0000000000000000 0000000000000000
              0x0000000041c43c60: 0000000000000000 0000000000000000
              0x0000000041c43c70: 0000000000000000 00002aaad9010000
              0x0000000041c43c80: 0000000041c43be0 0000000000000000
              
              Instructions: (pc=0x00002aaadb14402d)
              0x00002aaadb14401d: 8b 7c c1 08 48 3b 39 74 28 48 8b 57 08 48 8b 07
              0x00002aaadb14402d: 48 89 02 48 8b 17 48 85 d2 74 08 48 8b 47 08 48
              
              Stack: [0x0000000041b45000,0x0000000041c46000), sp=0x0000000041c43a90, free space=1018k
              Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
              C [libphp5.so+0x2bb02d] shutdown_memory_manager+0x6d
              
              Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
              j org.apache.catalina.servlets.php.Handler.php([BLorg/apache/catalina/servlets/php/ScriptEnvironment;Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)I+0
              j org.apache.catalina.servlets.php.Handler.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+102
              j javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+30
              j org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+354
              j org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+101
              j org.apache.catalina.core.StandardWrapperValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+695
              j org.apache.catalina.core.StandardContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+285
              j org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+342
              j org.apache.catalina.authenticator.AuthenticatorBase.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+675
              j org.jboss.web.tomcat.security.JaccContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+32
              j org.apache.catalina.core.StandardHostValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+64
              j org.apache.catalina.valves.ErrorReportValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+6
              j org.apache.catalina.valves.FastCommonAccessLogValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+6
              j org.apache.catalina.core.StandardEngineValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+42
              j org.apache.catalina.connector.CoyoteAdapter.service(Lorg/apache/coyote/Request;Lorg/apache/coyote/Response;)V+141
              j org.apache.coyote.http11.Http11AprProcessor.process(J)Z+473
              j org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(J)Z+323
              j org.apache.tomcat.util.net.AprEndpoint$Worker.run()V+50
              j java.lang.Thread.run()V+11
              v ~StubRoutines::call_stub
              



              Other details that may be of help:

              [root@pub-srv-001 ~]# ldd /usr/jboss/jbossweb-1.0.1.GA/PHP/lib/libphp5servlet.so
               libphp5.so => /usr/jboss/jbossweb-1.0.1.GA/PHP/lib/libphp5.so (0x00002aaaaabb1000)
               libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002aaaab2a1000)
               libmysqlclient.so.15 => /usr/lib64/mysql/libmysqlclient.so.15 (0x00002aaaab3d5000)
               libldap-2.3.so.0 => /usr/lib64/libldap-2.3.so.0 (0x00002aaaab645000)
               liblber-2.3.so.0 => /usr/lib64/liblber-2.3.so.0 (0x00002aaaab77f000)
               libgd.so.2 => /usr/lib64/libgd.so.2 (0x00002aaaab88d000)
               libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00002aaaab9e2000)
               libX11.so.6 => /usr/lib64/libX11.so.6 (0x00002aaaabb54000)
               libXpm.so.4 => /usr/lib64/libXpm.so.4 (0x00002aaaabc5b000)
               libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x00002aaaabd6d000)
               libz.so.1 => /usr/lib64/libz.so.1 (0x00002aaaabe94000)
               libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00002aaaabfa8000)
               libssl.so.6 => /lib64/libssl.so.6 (0x00002aaaac0cb000)
               libcrypto.so.6 => /lib64/libcrypto.so.6 (0x00002aaaac214000)
               libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x00002aaaac45f000)
               libresolv.so.2 => /lib64/libresolv.so.2 (0x00002aaaac570000)
               libm.so.6 => /lib64/libm.so.6 (0x00002aaaac685000)
               libdl.so.2 => /lib64/libdl.so.2 (0x00002aaaac806000)
               libnsl.so.1 => /lib64/libnsl.so.1 (0x00002aaaac90b000)
               libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002aaaaca22000)
               libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00002aaaacc5a000)
               libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00002aaaacd73000)
               libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00002aaaaceeb000)
               libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00002aaaad00e000)
               libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaad111000)
               libc.so.6 => /lib64/libc.so.6 (0x00002aaaad229000)
               libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00002aaaad472000)
               libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00002aaaad58a000)
               libXau.so.6 => /usr/lib64/libXau.so.6 (0x00002aaaad6cd000)
               libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00002aaaad7d1000)
               /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)
               libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00002aaaad8d6000)
               libexpat.so.0 => /lib64/libexpat.so.0 (0x00002aaaad9da000)
              [root@pub-srv-001 ~]#
              [root@pub-srv-001 ~]# /usr/jboss/jbossweb-1.0.1.GA/PHP/bin/php -i | more
              phpinfo()
              PHP Version => 5.1.6
              
              System => Linux pub-srv-001.psn.prolancer.com.au 2.6.18-1.2257.fc5 #1 SMP Fri De
              c 15 16:07:14 EST 2006 x86_64
              Build Date => Feb 9 2007 14:54:41
              Configure Command => './configure' '--prefix=/usr/jboss/jbossweb-1.0.1.GA/PHP'
              '--host=x86_64-redhat-linux' '--cache-file=Linux_x86_64_cache' '--with-libdir=li
              b64' '--with-pic' '--enable-shared' '--enable-static' '--enable-embed=shared' '-
              -with-tsrm-pthreads' '--without-pear' '--with-zend-vm=CALL' '--with-config-file-
              path=/usr/jboss/jbossweb-1.0.1.GA/PHP' '--disable-ipv6' '--with-libxml-dir=/usr'
               '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-kerberos=/usr' '--with-
              zlib=/usr' '--with-zlib-dir=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-
              calendar' '--enable-dba' '--enable-dbase' '--enable-exif' '--with-fbsql=no' '--w
              ith-fdftk=no' '--enable-filepro' '--enable-ftp' '--with-gd=/usr' '--with-jpeg-di
              r=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-ttf' '--with-freetyp
              e-dir=/usr' '--with-t1lib=no' '--enable-gd-native-ttf' '--with-gettext=/usr' '--
              with-gmp=no' '--with-hwapi=no' '--with-imap-ssl=/usr' '--with-informix=no' '--wi
              th-interbase=no' '--with-ldap=/usr' '--enable-mbstring' '--with-mcrypt=no' '--wi
              th-mhash=no' '--with-ming=no' '--with-msql=no' '--with-mssql=no' '--without-sqli
              te' '--with-sybase=no' '--with-sybase-ct=no' '--with-mysql=/usr' '--with-mysqli=
              /usr/bin/mysql_config' '--with-ncurses=no' '--with-oci8=no' '--with-pdo-mysql=/u
              sr' '--with-pdo-oci=no' '--with-pdo-dblib=no' '--with-pdo-firebird=no' '--with-p
              do-odbc=no' '--with-pdo-pgsql=no' '--without-pdo-sqlite' '--with-pgsql=no' '--wi
              th-libedit=no' '--with-recode=no' '--disable-reflection' '--enable-shmop' '--wit
              h-snmp=no' '--enable-soap' '--enable-sockets' '--disable-spl' '--enable-sysvmsg'
               '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-xmlrpc' '--withou
              t-iconv' '--enable-maintainer-zts'
              Server API => Command Line Interface
              Virtual Directory Support => enabled
              Configuration File (php.ini) Path => /usr/jboss/jbossweb-1.0.1.GA/PHP/php.ini
              PHP API => 20041225
              PHP Extension => 20050922
              Zend Extension => 220051025
              Debug Build => no
              Thread Safety => enabled
              Zend Memory Manager => enabled
              IPv6 Support => disabled
              Registered PHP Streams => php, file, http, ftp, compress.bzip2, compress.zlib, h
              ttps, ftps
              Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, t
              ls
              Registered Stream Filters => string.rot13, string.toupper, string.tolower, strin
              g.strip_tags, convert.*, consumed, bzip2.*, zlib.*
              
              
              This program makes use of the Zend Scripting Language Engine:
              Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
              :
              :
              [root@pub-srv-001 ~]# gcc -v
              Using built-in specs.
              Target: x86_64-redhat-linux
              Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
              Thread model: posix
              gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)
              [root@pub-srv-001 ~]#
              [root@pub-srv-001 ~]# cat /usr/jboss/jbossweb-1.0.1.GA/PHP/php.ini
              register_globals = on
              [root@pub-srv-001 ~]#
              [root@pub-srv-001 ~]# uname -a
              Linux pub-srv-001.xxx.xxx.xxx 2.6.18-1.2257.fc5 #1 SMP Fri Dec 15 16:07:14 EST 2006 x86_64 x86_64 x86_64 GNU/Linux
              [root@pub-srv-001 ~]#
              


              The above problem is with jbossweb-1.0.1.GA-linux2-x86_64.tar.gz; however I tried jbossweb-1.0.1.GA-linux2-i686.tar.gz as well (see my original post).

              I compiled the php5servlet which I got from svn using the steps listed in the first reply to my original post.

              I may be wrong but:-
              I snooped through the code in php5servlet.c and the PHP code and appears that one of the calls to php_request_shutdown(NULL) in JPHP_IMPLEMENT_CALL(jint, Handler, php)(...) is causing the problem when cleaning up elements of SG(request_info). I suspect it would be an element related to security as the problem does not appear when security is not involved.

              Again, to reproduce the problem simply create a WAR with a PHP file and add a security constraint to protect the access to the file. I describe this in my original post in a bit more detail.

              I spent some time sifting through PHP bugs (searching for anything with SIGSEGV), but did not find anything that comes close to what I am observing.

              I am desparate for a fix on this one. Help in any form: pointers, solution ... is more than welcome.

              Emil


              • 4. Re: libphp5.so crashes JVM when using <security-constraint>
                prolancer

                To add to my final reply:-
                The problem occured while using Java 6; however I tried 5 as well with the same result.

                [root@pub-srv-001 ~]# java -version
                java version "1.6.0"
                Java(TM) SE Runtime Environment (build 1.6.0-b105)
                Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode)
                


                Emil



                • 5. Re: libphp5.so crashes JVM when using <security-constraint>
                  prolancer

                  Continuing with the investigation:-
                  I added --enable-debug to the configure options for PHP and I get the following:

                  [Fri Feb 9 23:22:03 2007] Script: '........./index.php'
                  ---------------------------------------
                  /usr/src/jboss/php5servlet/php-5.1.6/main/SAPI.c(422) : Block 0x2AAADC38AA08 status:
                  Beginning: Overrun (magic=0x2AAADC389B50, expected=0x7312F8DC)
                   End: Unknown
                  ---------------------------------------
                  [Fri Feb 9 23:22:03 2007] Script: '................./index.php'
                  php5servlet.c(467) : Freeing 0x2AAADBEB07F8 (1 bytes), script=.........................../index.php
                  === Total 1 memory leaks detected ===
                  


                  Lines 421 to 423 in SAPI.c are:

                   if (SG(request_info).auth_user) {
                   efree(SG(request_info).auth_user);
                   }
                  


                  So the problem has to do with the inclusion of the 'Authorization: ' header in the HTTP request and possibly the copy of the value of username to SG(request_info).auth_user.


                  Hope this helps.
                  Emil



                  • 6. Re: libphp5.so crashes JVM when using <security-constraint>
                    jfclere

                    Thank now I know what is wrong, I will fix it.

                    • 7. Re: libphp5.so crashes JVM when using <security-constraint>
                      jfclere

                      I have committed the changes please try with it.

                      • 8. Re: libphp5.so crashes JVM when using <security-constraint>
                        prolancer

                        It appears that the changes fix the problem.

                        Thanks a bunch
                        Emil