php / php/php-src

libphp.so dumps core in sapi_register_post_entry+0x31()

Open
#8,445 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug SAPI: apache2handler Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

Starting Apache with libphp imediately ends with core dump:

httpd:core> $C
    7fdd8f067660 libphp8.1.so`sapi_register_post_entry+0x31()
    7fdd8f067680 libphp8.1.so`sapi_register_post_entries+0x2a()
    7fdd8f067690 libphp8.1.so`php_setup_sapi_content_types+0x10()
    7fdd8f0676e0 libphp8.1.so`tsrm_update_active_threads+0xb0()
    7fdd8f067720 libphp8.1.so`ts_allocate_fast_id+0xe3()
    7fdd8f067760 libphp8.1.so`php_apache_server_startup+0x6c()
    7fdd8f0677b0 ap_run_post_config+0x54()
    7fdd8f0678f0 main+0x1873()
    7fdd8f067900 0x465fc4()

This worked well with PHP 8.1.0.

git bisessct gives following output:

72f8dbb31295e4e5633a9033c6d91a45d102c485 is the first bad commit
commit 72f8dbb31295e4e5633a9033c6d91a45d102c485
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Nov 24 20:43:30 2021 +0300

    Fixed bug #81634 (ZEND_ENABLE_STATIC_TSRMLS_CACHE produces extensionswith the STATIC_TLS flag)

 TSRM/TSRM.h              | 8 ++++++--
 Zend/zend.c              | 2 +-
 Zend/zend.h              | 4 ++++
 build/php.m4             | 2 +-
 win32/build/confutils.js | 2 +-
 5 files changed, 13 insertions(+), 5 deletions(-)

Apply reversely patch from above commit allows me to use PHP 8.1.5.

PHP Version

PHP 8.1.5

Operating System

Solaris

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Apache/libphp startup crash on Solaris and reviewing the first bad commit, 72f8dbb31295e4e5633a9033c6d91a45d102c485. Read TSRM/TSRM.h, Zend/zend.c, Zend/zend.h, and build/php.m4 around that change. Done means PHP 8.1.5 can start with libphp without dumping core and the regression is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.