Bug #81612 [Opn]: Segmentation fault on PHP 8.1 with pcov

From: Date: Fri, 12 Nov 2021 11:44:20 +0000
Subject: Bug #81612 [Opn]: Segmentation fault on PHP 8.1 with pcov
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237719@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81612&edit=1

 ID:                 81612
 Updated by:         nikic@php.net
 Reported by:        bartos dot developer152 at gmail dot com
-Summary:            Segmentation fault on PHP 8.1
+Summary:            Segmentation fault on PHP 8.1 with pcov
 Status:             Open
 Type:               Bug
 Package:            Reproducible crash
 Operating System:   Ubuntu 20.04.3
 PHP Version:        8.1Git-2021-11-11 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

https://github.com/krakjoe/pcov/pull/75 fixes
the issue for me.


Previous Comments:
------------------------------------------------------------------------
[2021-11-12 11:16:42] nikic@php.net

Testing with pcov now, I see this valgrind warning:

==1363300== Invalid read of size 4
==1363300==    at 0x8535BA: zend_string_release (zend_string.h:319)
==1363300==    by 0x853AB4: zm_deactivate_filestat (filestat.c:91)
==1363300==    by 0x828BFB: zm_deactivate_basic (basic_functions.c:541)
==1363300==    by 0xA3AF67: zend_deactivate_modules (zend_API.c:3016)
==1363300==    by 0x98B198: php_request_shutdown (main.c:1823)
==1363300==    by 0xB9FE2A: do_cli (php_cli.c:1135)
==1363300==    by 0xBA06FF: main (php_cli.c:1367)
==1363300==  Address 0xbc7b2b4 is 4 bytes inside a block of size 91 free'd
==1363300==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1363300==    by 0x66632B: php_pcov_filename_dtor (pcov.c:345)
==1363300==    by 0xA47E82: zend_hash_destroy (zend_hash.c:1590)
==1363300==    by 0x666952: zm_deactivate_pcov (pcov.c:493)
==1363300==    by 0xA3AF67: zend_deactivate_modules (zend_API.c:3016)
==1363300==    by 0x98B198: php_request_shutdown (main.c:1823)
==1363300==    by 0xB9FE2A: do_cli (php_cli.c:1135)
==1363300==    by 0xBA06FF: main (php_cli.c:1367)
==1363300==  Block was alloc'd at
==1363300==    at 0x483DD99: calloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1363300==    by 0x665E91: php_pcov_interned_string (pcov.c:210)
==1363300==    by 0x665F21: php_pcov_create (pcov.c:232)
==1363300==    by 0x6660D1: php_pcov_trace (pcov.c:270)
==1363300==    by 0x66625D: php_pcov_execute_ex (pcov.c:323)
==1363300==    by 0xA6B99A: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:1728)
==1363300==    by 0xAE4218: zend_vm_call_opcode_handler (zend_vm_execute.h:62999)
==1363300==    by 0x666117: php_pcov_trace (pcov.c:282)
==1363300==    by 0x66625D: php_pcov_execute_ex (pcov.c:323)
==1363300==    by 0xA6BDE1: ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:1837)
==1363300==    by 0xAE4218: zend_vm_call_opcode_handler (zend_vm_execute.h:62999)
==1363300==    by 0x666117: php_pcov_trace (pcov.c:282)

------------------------------------------------------------------------
[2021-11-12 11:05:21] bartos dot developer152 at gmail dot com

nikic@php.net:
That's it! Thank you, I had no idea it could be caused by pcov.
https://github.com/orisai/nette-console/runs/4188901103?check_suite_focus=true#step:13:99

------------------------------------------------------------------------
[2021-11-12 11:01:12] nikic@php.net

Would it be possible to test with pcov not enabled? Looking at the bug tracker there, https://github.com/krakjoe/pcov/issues/73 seems
to indicate that there may be a compatibility issue between pcov and PHP 8.1.

------------------------------------------------------------------------
[2021-11-12 10:55:23] bartos dot developer152 at gmail dot com

Danack at basereality dot com:
Thank you it seems to work now. Unfortunately it added only this to output

> [Inferior 1 (process 3171) exited with code 02]
> No stack.

https://github.com/orisai/nette-console/runs/4188618661?check_suite_focus=true#step:13:117


nikic@php.net:
My full command was this, hopefully it will be helpful
XDEBUG_MODE=off php -d pcov.enabled=1 -d pcov.directory=./src "vendor/bin/paratest" -c
tools/phpunit.xml --runner=WrapperRunner -p16 --coverage-clover=var/coverage/clover.xml

------------------------------------------------------------------------
[2021-11-12 09:41:29] nikic@php.net

I wasn't able to reproduce this locally (using nette-console). I used this command:

~/php/php-8.1/sapi/cli/php vendor/bin/paratest -c tools/phpunit.xml --runner=WrapperRunner -p32

Not seeing any warnings under valgrind either.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=81612


--
Edit this bug report at https://bugs.php.net/bug.php?id=81612&edit=1


Thread (11 messages)

« previous php.bugs (#237719) next »