php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78295 session_create_id causes SIGSEGV
Submitted: 2019-07-15 21:24 UTC Modified: 2019-07-28 04:22 UTC
From: ilija dot tovilo at me dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 7.3.6 OS: Linux/Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-07-15 21:24 UTC] ilija dot tovilo at me dot com
Description:
------------
We've upgraded to from PHP 7.0 to PHP 7.3 and started experiencing PHP-FPM crashes in production. Turns out it was caused by a call to session_create_id() in the SimpleSaml library:

https://github.com/simplesamlphp/simplesamlphp/issues/1158

The issue would arise randomly about 2-3 times a day. We've tried to get a core dump but have not managed to do so yet.

In the meantime SimpleSaml has switched back to use `bin2hex(openssl_random_pseudo_bytes(16))` for session id generation for PHP 7.3. This has completely resolved the issue for us. No more crashes.

Test script:
---------------
Unfortunately, the issue only occurred in our production environment. We could not reproduce the issue in a short test script.

Expected result:
----------------
No crash.

Actual result:
--------------
/var/log/kern.log:

Jul  5 16:00:03 servername kernel: [265630.815422] traps: php-fpm7.3[21032] general protection ip:5580a3494efd sp:7fff8cff8498 error:0
Jul  5 16:00:03 servername kernel: [265630.815428]  in php-fpm7.3[5580a3231000+3ee000]

/var/log/php7.3-fpm.log:

[05-Jul-2019 16:24:44] WARNING: [pool www] child 21558 exited on signal 11 (SIGSEGV) after 0.454303 seconds from start
[05-Jul-2019 16:24:44] NOTICE: [pool www] child 21561 started

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-15 21:29 UTC] ilija dot tovilo at me dot com
-PHP Version: 7.3.7 +PHP Version: 7.3.6
 [2019-07-15 21:29 UTC] ilija dot tovilo at me dot com
Adjust tested PHP version
 [2019-07-16 09:00 UTC] nikic@php.net
I've been staring at the code, but don't see why it would crash. A stack strace would be very helpful.
 [2019-07-16 09:08 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2019-07-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2019-07-29 18:15 UTC] ilija dot tovilo at me dot com
Sorry for the late response. I'm on vacation right now.

I've been trying to get a stack trace or core dump but did not succeed. I'll try again next week when I'm back.

In the meantime, there are reports in the SimpleSaml issue that the same thing happens on PHP 7.2. So apparently it's not exclusive to PHP 7.3.
 [2019-07-29 18:55 UTC] tvdijen at gmail dot com
It did change between 7.2 and 7.3, as well as the bin_to_readable-method.

https://github.com/php/php-src/blob/PHP-7.2/ext/session/session.c#L324
https://github.com/php/php-src/blob/PHP-7.3/ext/session/session.c#L319

I've been trying to capture this in a trace for weeks but it happens too random, or at least, I haven't found a way to consistently reproduce it..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC