Project

General

Profile

Bug #4204

hipster: 64-bit PHP 5.4 core dumps at exit

Added by Alexander Pyhalov almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
OI-Userland
Target version:
-
Start date:
2013-10-14
Due date:
% Done:

100%

Estimated time:
40.00 h
Difficulty:
Medium
Tags:
php

Description

When intl extension and curl extension are both enabled, 64-bit PHP 5.4 dumps core at exit with the following trace:

$ mdb /usr/php/5.4/bin/amd64/php core
Loading modules: [ libc.so.1 ld.so.1 ]

$C

fffffd7fffdff6a0 libgcc_s.so.1`__deregister_frame_info_bases+0x3f()
fffffd7fffdff6c0 0xfffffd7ffb7c72a9()
fffffd7fffdff6d0 pkcs11_softtoken.so.1`_fini+9()
fffffd7fffdff770 ld.so.1`call_fini+0xf1(fffffd7fff3fc820, fffffd7fff040030, 0)
fffffd7fffdff7b0 ld.so.1`atexit_fini+0x6e()
fffffd7fffdff800 libc.so.1`__cxa_finalize+0x8c(0)
fffffd7fffdff820 libc.so.1`_exithandle+0x2c()
fffffd7fffdff840 libc.so.1`exit+0x11()
fffffd7fffdffce0 0x92c84b()
fffffd7fffdffcf0 _start+0x6c()

History

#1

Updated by Alexander Pyhalov almost 7 years ago

Extracted test case: just use some icu and curl functions in any C++ 64-bit program:

$ cat php_test.cc
#include <curl/curl.h>
#include <curl/easy.h>
#include <unicode/utypes.h>
#include <unicode/ucnv.h>
#include <unicode/unistr.h>
#include <unicode/translit.h>

int main() {
CURL* c;
UErrorCode err = U_ZERO_ERROR;
UConverter *convto = 0;

c = curl_easy_init();
convto = ucnv_open("/export/home/alp/ips.mk", &err);
return 0;
}

$ g++ -m64 -I /usr/g++/include/ -lcurl -L/usr/g++/lib/amd64/ -R/usr/g++/lib/amd64/ -licuuc php_test.cc
$ ./a.out
Segmentation Fault (core dumped)

#2

Updated by Alexander Pyhalov almost 7 years ago

Even more reduced test case:

#include <security/cryptoki.h>
#include <security/pkcs11.h>
#include <unicode/utypes.h>
#include <unicode/ucnv.h>
#include <unicode/unistr.h>
#include <unicode/translit.h>

int main() {
CK_RV rv;
UErrorCode err = U_ZERO_ERROR;
UConverter *convto = 0;

convto = ucnv_open("/export/home/alp/ips.mk", &err);
rv = C_Initialize(NULL_PTR);

if (rv != CKR_OK) {
fprintf(stderr, "C_Initialize: Error = 0x%.8X\\n", rv);
exit(1);
}

return 0;
}

$ g++ -m64 -I /usr/g++/include -lpkcs11 -L/usr/g++/lib/amd64 -R/usr/g++/lib/amd64 -licuuc php_test_pki.cc

#3

Updated by Alexander Pyhalov almost 7 years ago

And even more interesting testcase:
while linking 64-bit file with libpkcs11 and any c++ library with .fini section resulting file segfaults.

$ cat finish.cc
#include <iostream>

void finish() {
std::cout<<"Finishing\\n";
}

$ cat main.cc

#include <iostream>
#include <security/cryptoki.h>
#include <security/pkcs11.h>

void finish();

int main() {
CK_RV rv;
rv = C_Initialize(NULL_PTR);
return 0;
}

$ g++ -fPIC -m64 -o finish.o -c finish.cc
$ /usr/ccs/bin/ld -64 -G finish.o -h libfinish.so -z finiarray=_Z6finishv -o libfinish.so
$ g++ -m64 main.cc -lpkcs11 -L. -R. -lfinish -o main.out
$ ./main.out
Segmentation Fault (core dumped)

$ pstack core
core 'core' of 102586: ./main.out
fffffd7ffdea5a8f __deregister_frame_info_bases () + 3f
fffffd7ffcf072a9 ???? ()
fffffd7ffcf52a39 _fini () + 9
fffffd7fff3c0041 call_fini (fffffd7fff3fc820, fffffd7fff230030, 0) + f1
fffffd7fff3c01be atexit_fini () + 6e
fffffd7ffebf85cc __cxa_finalize (0) + 8c
fffffd7ffebf864c _exithandle () + 2c
fffffd7ffebe22a1 exit () + 11
0000000000400f76 _start () + 76

#4

Updated by Alexander Pyhalov almost 7 years ago

Illumos bug: #4215

Workaround: comment line "/usr/lib/security/$ISA/pkcs11_tpm.so" in /etc/crypto/pkcs11.conf

#5

Updated by Ken Mays almost 7 years ago

  • Category set to 10
  • Assignee set to OI Userland
  • Tags changed from needs-triage to php
#6

Updated by Alexander Pyhalov almost 7 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 100
#7

Updated by Ken Mays almost 7 years ago

  • Status changed from In Progress to Closed
  • Estimated time set to 40.00 h

Resolved. See:
,5.11-0.151.1.8.1:20131112T113501Z

Also available in: Atom PDF