FS#52974 - [php][owncloud] Could not gather sufficient random data (with php 7.1.2)

Attached to Project: Arch Linux
Opened by Mathias Rohnstock (mrohnstock) - Wednesday, 15 February 2017, 09:32 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 17 February 2017, 06:01 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:

After updating php from 7.1.1 to 7.1.2 and restarting php-fpm and nginx the following error occurred and owncloud won't start (log from nginx's error.log):

2017/02/15 10:16:26 [error] 21589#21589: *557 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Exception: Could not gather sufficient random data in /usr/share/webapps/owncloud/lib/private/Security/SecureRandom.php:80
Stack trace:
#0 /usr/share/webapps/owncloud/lib/private/Security/SecureRandom.php(80): random_int(0, 63)
#1 /usr/share/webapps/owncloud/lib/private/Security/Crypto.php(94): OC\Security\SecureRandom->generate(16)
#2 /usr/share/webapps/owncloud/lib/private/Session/CryptoSessionData.php(162): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'yQU2DBdBseipjD7...')
#3 /usr/share/webapps/owncloud/lib/private/Session/CryptoSessionData.php(66): OC\Session\CryptoSessionData->close()
#4 [internal function]: OC\Session\CryptoSessionData->__destruct()
#5 {main}
thrown in /usr/share/webapps/owncloud/lib/private/Security/SecureRandom.php on line 80" while reading upstream, client: 217.240.103.192, server: example.com, request: "PROPFIND /remote.php/webdav/ HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "example.com"

Restarting php-fpm and nginx won't help. Switching back to 7.1.1-1 solved the issue.

Additional info:
* php 7.1.2-1
* nginx 1.10.3-2
* owncloud 9.1.3-2

Steps to reproduce:
1. install & config owncloud and nginx
2. install php
3. profit from the error.
This task depends upon

Closed by  Doug Newgard (Scimmia)
Friday, 17 February 2017, 06:01 GMT
Reason for closing:  Not a bug
Comment by Mathias Rohnstock (mrohnstock) - Wednesday, 15 February 2017, 11:08 GMT
hm, this issue doesn't occurred on the server at work with same installed versions as above. Strange ...
Comment by Aleeex87 (aleeex87) - Wednesday, 15 February 2017, 12:52 GMT
I'm experiencing the same issue as well on armv7h..
Comment by Benjamin Robin (benjarobin) - Wednesday, 15 February 2017, 21:23 GMT
In php 7.1.1 it is using /dev/urandom, but now in php 7.1.2 it is using getrandom().
The problem is that getrandom() was introduced in version 3.17 of the Linux kernel...

Related subject on forums:
https://archlinuxarm.org/forum/viewtopic.php?t=11321&p=54711
https://forums.archlinux.fr/viewtopic.php?f=5&t=18917
Comment by Jan de Groot (JGC) - Thursday, 16 February 2017, 09:31 GMT
We support linux 4.9 and linux 4.4, so I don't see why this is a problem on our side. Yes this will screw users who use Arch inside a container or Xen system that is running an older kernel, but those users can recompile PHP on their system to get this fixed.

I looked into the PHP code, the getrandom() call is hardcoded at compile time if the syscall is available on the system that compiles php. There's no runtime fallback.
Comment by Mathias Rohnstock (mrohnstock) - Thursday, 16 February 2017, 09:46 GMT
benjarobin made a PR so this will hopefully get fixed upstream.

https://github.com/php/php-src/pull/2385

See also the bugreport: https://bugs.php.net/bug.php?id=74105

requested closure of this issue, as it is not directly related to archlinux - issue occurred on my arm board using linux 3.10.

Loading...