View Issue Details

IDProjectCategoryView StatusLast Update
0000093XdebugUncategorizedpublic2004-10-12 15:56
Reporterratchet Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionreopened 
Summary0000093: crash in lookup_hostname on x86_64
Description

Under certain circumstances, setting the remote_port seems to be overwriting the memory that stores the remote_host. Using PHP CLI, this occurs when setting remote_port after remote_host in the environment:

ratchet@rsdev:~> XDEBUG_CONFIG="remote_enable=1 remote_handler=dbgp remote_host=localhost remote_port=8009" php test.php
Segmentation fault

Additional Information

This appears to be an issue with the xdebug_globals structure. While debugging I observed the remote_host member being set correctly, but once the remote_port directive was porcessed it was set to NULL. This caused inet_aton to crash.

I suspect this is a word size issue, since changing the remote_port member's type from int to long seemed to fix the problem. I will submit a patch in a seperate note.

Backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182909524992 (LWP 15043)]
0x0000002a962bf777 in inet_aton () from /lib64/tls/libc.so.6
(gdb) bt
#0 0x0000002a962bf777 in inet_aton () from /lib64/tls/libc.so.6
#1 0x0000002a9642c9cd in lookup_hostname (addr=0x0, in=0x7fbfffc854)
at /home/ratchet/src/xdebug-2.0.0beta1/xdebug_com.c:61
0000002 0x0000002a9642ca4f in xdebug_create_socket (hostname=0x0, dport=8009)
at /home/ratchet/src/xdebug-2.0.0beta1/xdebug_com.c:87
0000003 0x0000002a96429894 in xdebug_execute (op_array=0x813038)
at /home/ratchet/src/xdebug-2.0.0beta1/xdebug.c:992
0000004 0x00000000004d7b0a in zend_execute_scripts (type=0, retval=0x7fbfffc854, file_count=3)
at /usr/src/packages/BUILD/php-4.3.4/Zend/zend.c:884
0000005 0x00000000004ac4bb in php_execute_script (primary_file=0x7fbfffee50)
at /usr/src/packages/BUILD/php-4.3.4/main/main.c:1732
0000006 0x00000000004ebd33 in main (argc=2, argv=0x7fbfffefa8)
at /usr/src/packages/BUILD/php-4.3.4/sapi/cli/php_cli.c:819
(gdb)

TagsNo tags attached.
Operating SystemSUSE Linux 9.1/x86_64
PHP Version4.3.4

Activities

ratchet

2004-10-06 15:25

reporter   ~0000197

Proposed fix, made against the CVS code as of 2004-10-05:

Index: php_xdebug.h

RCS file: /repository/xdebug/php_xdebug.h,v
retrieving revision 1.81
diff -u -r1.81 php_xdebug.h
--- php_xdebug.h 3 Oct 2004 13:10:56 -0000 1.81
+++ php_xdebug.h 6 Oct 2004 01:43:45 -0000
@@ -93,7 +93,7 @@

    int           level;
    xdebug_llist *stack;
  • int max_nesting_level;
  • long max_nesting_level;
    zend_bool default_enable;
    zend_bool collect_includes;
    zend_bool collect_params;
    @@ -138,7 +138,7 @@

    /* remote settings */
    zend_bool     remote_enable;  /* 0 */
  • int remote_port; / 9000 /
  • long remote_port; / 9000 /
    char remote_host; / localhost /
    int remote_mode; /
    XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ /
    char
    remote_handler; / php3, gdb, dbgp /

derick

2004-10-06 15:59

administrator   ~0000198

Fixed in Cvs, thanks for the patch. There might be some more 64bit issues, but unfortunately I do not have access to a 64bit machine running linux.

ratchet

2004-10-06 18:10

reporter   ~0000199

Found related problem when specifying remote_handler at the end of the options string:

ratchet@rsdev:~> XDEBUG_CONFIG="remote_enable=1 remote_host=localhost remote_port=9998 remote_handler=dbgp" php test.php
Segmentation fault

ratchet

2004-10-06 18:13

reporter   ~0000200

Another proposed patch, made against CVS as of 2004-10-06:

Index: php_xdebug.h

RCS file: /repository/xdebug/php_xdebug.h,v
retrieving revision 1.82
diff -u -r1.82 php_xdebug.h
--- php_xdebug.h 6 Oct 2004 14:58:38 -0000 1.82
+++ php_xdebug.h 6 Oct 2004 17:06:49 -0000
@@ -140,7 +140,7 @@
zend_bool remote_enable; / 0 /
long remote_port; / 9000 /
char remote_host; / localhost */

  • int remote_mode; / XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ /
  • long remote_mode; / XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ /
    char remote_handler; / php3, gdb, dbgp /
    zend_bool remote_autostart; /
    Disables the requirement for XDEBUG_SESSION_START */

This appears to be the last xdebug_globals integer value that zend_alter_ini_entry touches.

derick

2004-10-12 15:56

administrator   ~0000203

Fixed in CVS.

Issue History

Date Modified Username Field Change
2004-10-06 15:23 ratchet New Issue
2004-10-06 15:25 ratchet Note Added: 0000197
2004-10-06 15:59 derick Status new => closed
2004-10-06 15:59 derick Note Added: 0000198
2004-10-06 18:10 ratchet Status closed => feedback
2004-10-06 18:10 ratchet Resolution open => reopened
2004-10-06 18:10 ratchet Note Added: 0000199
2004-10-06 18:13 ratchet Note Added: 0000200
2004-10-12 15:56 derick Status feedback => closed
2004-10-12 15:56 derick Note Added: 0000203
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized