php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64692 Segfault with geoip extension and GeoIP API 1.5
Submitted: 2013-04-22 17:16 UTC Modified: 2014-04-28 12:25 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: mail at daniel-berlin dot de Assigned: ohill (profile)
Status: Closed Package: geoip (PECL)
PHP Version: 5.4.14 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: mail at daniel-berlin dot de
New email:
PHP Version: OS:

 

 [2013-04-22 17:16 UTC] mail at daniel-berlin dot de
Description:
------------
The Geoip extension causes an immediate segfault of the corresponding apache process when compiled agains the API v1.5.0. With v1.4.8 it works without problems.

Test script:
---------------
<?php print_r(geoip_db_get_all_info());


Expected result:
----------------
Array dump

Actual result:
--------------
None (apache process segfaults)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-22 18:26 UTC] ohill@php.net
-Status: Open +Status: Feedback
 [2013-04-22 18:26 UTC] ohill@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Seems related to #60066

Can you check which PECL version of geoip you are using? Seems to work here with 
geoip 1.0.8 and libgeoip 1.5.0
 [2013-04-27 18:28 UTC] mail at daniel-berlin dot de
-Status: Feedback +Status: Open
 [2013-04-27 18:28 UTC] mail at daniel-berlin dot de
Hi.
When I use geoip 1.0.8, GeoIP C API 1.5.0 and apache 2.2.22 -> I get a segmentation fault.
After switching back to the GeoIP C API 1.4.8 it works fine (absolutely nothing else changed).
No strange configure options or compiler flags set...

Regards, Daniel
 [2013-06-27 08:13 UTC] xoJIog at inbox dot lv
I've experienced the same problem with geoip-1.5.0 and geoip-1.5.1 working with php-fpm v.5.3.17
--------------
kernel: php-fpm[20929]: segfault at 14 ip a5037659 sp b6c56ac0 error 4 in libGeoIP.so.1.5.0[a502d000+31000]
kernel: grsec: From 10.0.1.7: Segmentation fault occurred at 00000014 in /usr/lib/php5.3/bin/php-fpm[php-fpm:20929], parent /usr/lib/php5.3/bin/php-fpm[php-fpm:20928]
kernel: grsec: From 10.0.1.7: denied resource overstep by requesting 4096 for RLIMIT_CORE against limit 0 for /usr/lib/php5.3/bin/php-fpm[php-fpm:20929], parent /usr/lib/php5.3/bin/php-fpm[php-fpm:20928]
 [2013-06-27 11:35 UTC] ohill@php.net
-Status: Open +Status: Feedback
 [2013-06-27 11:35 UTC] ohill@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.

A backtrace would help a lot here since I cannot reproduce on my setup.
 [2013-07-03 20:21 UTC] mail at daniel-berlin dot de
-Status: Feedback +Status: Open
 [2013-07-03 20:21 UTC] mail at daniel-berlin dot de
Hi.
Reproducted the segfault with pecl geoip 1.0.8 and GeoIP API 1.5.1.
Both pecl extension and api built without any additional options.

Unfortunately I cannot create a coredump file (I'm inside a shared environment and coredumps are disabled).
 [2013-07-03 20:56 UTC] mail at daniel-berlin dot de
Here is a backtrace:

Core was generated by `/usr/bin/httpd -k start'.
Program terminated with signal 11, Segmentation fault.
#0  0xb7542846 in __strlen_sse2_bsf () from /usr/lib/libc.so.6
(gdb) bt
#0  0xb7542846 in __strlen_sse2_bsf () from /usr/lib/libc.so.6
#1  0xb619dcc8 in zif_geoip_database_info ()
   from /usr/local/php-5.5.0/lib/php/20121212/geoip.so
#2  0xb6d7cdbc in zend_do_fcall_common_helper_SPEC () from /usr/local/php/lib/libphp5.so
#3  0xb6cdaf36 in execute_ex () from /usr/local/php/lib/libphp5.so
#4  0xb6d7acb1 in zend_execute () from /usr/local/php/lib/libphp5.so
#5  0xb6cabdd9 in zend_execute_scripts () from /usr/local/php/lib/libphp5.so
#6  0xb6c3b1b6 in php_execute_script () from /usr/local/php/lib/libphp5.so
#7  0xb6d7ece8 in php_handler () from /usr/local/php/lib/libphp5.so
#8  0x0807827d in ap_run_handler ()
#9  0x080785ef in ap_invoke_handler ()
#10 0x08085590 in ap_process_request ()
#11 0x08082aa8 in ?? ()
#12 0x0807eabd in ap_run_process_connection ()
#13 0x0808a716 in ?? ()
#14 0x0808ac13 in ?? ()
#15 0x0808acdd in ?? ()
#16 0x0808bd10 in ap_mpm_run ()
#17 0x08063fa4 in main ()
(gdb)
 [2014-04-28 04:03 UTC] anthon at piwik dot org
In 1.5.0, Maxmind removed support for a couple of database types.

Change:
add_assoc_string(row, "description", (char *)GeoIPDBDescription[i], 1);

To:
if (GeoIPDBDescription[i]) {
add_assoc_string(row, "description", (char *)GeoIPDBDescription[i], 1);
}
 [2014-04-28 12:25 UTC] ohill@php.net
Automatic comment from SVN on behalf of ohill
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=333440
Log: Bug 64692
 [2014-04-28 12:25 UTC] ohill@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ohill
 [2014-04-28 12:25 UTC] ohill@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Sep 23 04:01:25 2020 UTC