php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77800 phpdbg segfaults on listing some conditional breakpoints
Submitted: 2019-03-26 21:43 UTC Modified: -
From: lauter dot miriam at gmail dot com Assigned:
Status: Closed Package: phpdbg
PHP Version: master-Git-2019-03-26 (Git) OS: Linux
Private report: No CVE-ID: None
 [2019-03-26 21:43 UTC] lauter dot miriam at gmail dot com
Description:
------------
phpdbg segfaults when attempting to run after setting a conditional breakpoint using the NUMERIC_PARAM (lineno only) format.

# repro steps
phpdbg -f script.php

b @ 3 if $i > 1
r

# further discussion
 
phpdbg supports expressing non-conditional breakpoints in a number of different ways: file, method, opcode etc. The supported expression format for conditional breakpoints appears to be far less flexible. Currently, in order for a conditional breakpoint to work, the location param must be given as the absolute path to a file:lineno. Not doing so leads to surprising results (e.g. segfault or silent failure).




Test script:
---------------
<?php
$i = 1;
echo $i++;
echo $i++;
echo $i++;
echo $i++;

Expected result:
----------------
1. phpdbg does not segfault even if breakpoint format input by the user is malformed or unsupported.

2. if a user attempts to set a breakpoint in a way that is unsupported, phpdbg immediately emits an error (as opposed to silently failing or failing later.)

3. to the extent that it's sensible, phpdbg should support expressing conditional breakpoints in all the same ways it is possible to express non-conditional breakpoints.

Actual result:
--------------
(gdb) bt
#0  0x00007f0089d524c7 in kill () at ../sysdeps/unix/syscall-template.S:81
#1  0x0000000000841001 in zend_signal_handler (signo=signo@entry=11, siginfo=siginfo@entry=0x7fff3547edb0, context=context@entry=0x7fff3547ec80)
    at /usr/src/debug/php-src-php-7.1.18/Zend/zend_signal.c:209
#2  0x00000000008410db in zend_signal_handler_defer (signo=11, siginfo=0x7fff3547edb0, context=0x7fff3547ec80)
    at /usr/src/debug/php-src-php-7.1.18/Zend/zend_signal.c:106
#3  0x00007f008e06d5e0 in <signal handler called> () at /lib64/libpthread.so.0
#4  0x00000000008c0dae in phpdbg_export_breakpoints_to_string (str=str@entry=0x7fff3547f490) at /usr/src/debug/php-src-php-7.1.18/sapi/phpdbg/phpdbg_bp.c:235
#5  0x0000000000455fb1 in main (argc=3, argv=0x7fff3547f8e8) at /usr/src/debug/php-src-php-7.1.18/sapi/phpdbg/phpdbg.c:2010

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-26 21:55 UTC] petk@php.net
The following pull request has been associated:

Patch Name: Fix #77800: phpdbg segfaults on listing some conditional breakpoints
On GitHub:  https://github.com/php/php-src/pull/3992
Patch:      https://github.com/php/php-src/pull/3992.patch
 [2019-03-26 22:07 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7df8e4fc0abc105cd5d7b933499bdd275459f7ee
Log: Fix #77800 phpdbg segfaults on conditional breakpoints
 [2019-03-26 22:07 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 17:01:26 2024 UTC