Bug #71200 [Opn->Fbk]: incorrect getrandom checks
| From: | krakjoe@php.net | Date: | Mon, 09 Jan 2017 05:46:32 +0000 |
| Subject: | Bug #71200 [Opn->Fbk]: incorrect getrandom checks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206424@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71200&edit=1
ID: 71200
Updated by: krakjoe@php.net
Reported by: crrodriguez at opensuse dot org
Summary: incorrect getrandom checks
-Status: Open
+Status: Feedback
Type: Bug
Package: *Compile Issues
Operating System: linux
PHP Version: master-Git-2015-12-22 (Git)
-Assigned To:
+Assigned To: leigh
Block user comment: N
Private report: N
New Comment:
Leigh can you open a PR on github for this please.
Previous Comments:
------------------------------------------------------------------------
[2015-12-24 01:39:52] crrodriguez at opensuse dot org
@leigh That should also work just fine.
------------------------------------------------------------------------
[2015-12-23 21:56:21] leigh@php.net
@crrodriguez Looks like a simple fix, this works on my system, can you give it a quick test on
yours?
https://github.com/lt/php-src/tree/getrandom-fix
------------------------------------------------------------------------
[2015-12-23 16:10:38] crrodriguez at opensuse dot org
@ab No I do not mean getrandom() may be missing. There is no getrandom declaration to check for,
glibc does not (yet) provide a wrapper to this system call and it is not clear if it ever will..
even if it did, it might end with different semantics or parameters..but this is a moot point as the
code does not use it but the syscall interface instead, which case you need to test if you are in
linux and if the SYS_getrandom macro is defined.
------------------------------------------------------------------------
[2015-12-23 15:59:28] ab@php.net
Thanks for the report. HAVE_DECL_GETRANDOM is generated by autotools, please see
ext/standard/config.m4 . Do you mean the getrandom declaration could be missing, but the syscall
still available? If so, probably better to check both.
Thanks.
------------------------------------------------------------------------
[2015-12-23 00:47:40] crrodriguez at opensuse dot org
Description:
------------
getrandom() system call is not used on linux due to incorrect ifdef's.
HAVE_DECL_GETRANDOM is always undefined as there is no declaration of getrandom on the C library or
kernel headers and the code that follows does not use it, only the raw syscall interface.
Test script:
---------------
strace -egetrandom php -r 'random_bytes(1);'
Expected result:
----------------
getrandom("\221", 1, 0) = 1
Actual result:
--------------
(nothing, getrandom unused)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71200&edit=1