php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66242 CLI server failure on 64-bit ARM (Aarch64)
Submitted: 2013-12-06 02:52 UTC Modified: 2013-12-20 05:11 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: thuhc at yahoo dot com Assigned: ardbiesheuvel (profile)
Status: Closed Package: Testing related
PHP Version: 5.5.6 OS: Linux AARCH64
Private report: No CVE-ID: None
 [2013-12-06 02:52 UTC] thuhc at yahoo dot com
Description:
------------
I built php 5.5.4 on ARM AARCH64 CPU, system linux 64bits
I ran make test, I got issues:
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
finfo_file(): Testing mime types [ext/fileinfo/tests/finfo_file_002.phpt]
Bug #65304 (Use of max int in array_sum) [ext/standard/tests/array/bug65304.phpt]
Test fileperms(), chmod() functions: error conditions [ext/standard/tests/file/006_error.phpt]
Test fileperms() & chmod() functions: usage variation - misc. perms [ext/standard/tests/file/006_variation2.phpt]
chmod() basic functionality [ext/standard/tests/file/chmod_basic.phpt]
Test lchgrp() function : basic functionality [ext/standard/tests/file/lchgrp_basic.phpt]
Test lchown() function : basic functionality [ext/standard/tests/file/lchown_basic.phpt]
gethostbyname() function - basic return valid ip address test [ext/standard/tests/network/gethostbyname_error004.phpt]
getmxrr() test [ext/standard/tests/network/getmxrr.phpt]
http-stream test [ext/standard/tests/network/http-stream.phpt]
Test strncmp() function : usage variations - binary safe(binary values) [ext/standard/tests/strings/strncmp_variation6.phpt]
Bug #61977 Test exit code for various errors [sapi/cli/tests/bug43177.phpt]
Bug #61546 (functions related to current script failed when chdir() in cli sapi) [sapi/cli/tests/bug61546.phpt]
Bug #61679 (Error on non-standard HTTP methods) [sapi/cli/tests/bug61679.phpt]
Bug #61977 test CLI web-server support for Mime Type File extensions mapping [sapi/cli/tests/bug61977.phpt]
Bug #65066 (Cli server not responsive when responding with 422 http status code): 100 status code [sapi/cli/tests/bug65066_100.phpt]
Bug #65066 (Cli server not responsive when responding with 422 http status code): 422 status code [sapi/cli/tests/bug65066_422.phpt]
Bug #65066 (Cli server not responsive when responding with 422 http status code): 511 status code [sapi/cli/tests/bug65066_511.phpt]
Bug #65633 (built-in server treat some http headers as case-sensitive) [sapi/cli/tests/bug65633.phpt]
basic function [sapi/cli/tests/php_cli_server_001.phpt]
$_SERVER variable [sapi/cli/tests/php_cli_server_002.phpt]
Bug #55726 (Changing the working directory makes router script inaccessible) [sapi/cli/tests/php_cli_server_003.phpt]
Bug #55747 (request headers missed in $_SERVER) [sapi/cli/tests/php_cli_server_004.phpt]
Post a file [sapi/cli/tests/php_cli_server_005.phpt]
Bug #55755 (SegFault when outputting header WWW-Authenticate) [sapi/cli/tests/php_cli_server_006.phpt]
Bug #55758 (Digest Authenticate missed in 5.4) [sapi/cli/tests/php_cli_server_007.phpt]
SERVER_PROTOCOL header availability [sapi/cli/tests/php_cli_server_008.phpt]
PATH_INFO (relevant to #60112) [sapi/cli/tests/php_cli_server_009.phpt]
Bug #60180 ($_SERVER["PHP_SELF"] incorrect) [sapi/cli/tests/php_cli_server_010.phpt]
Bug #60159 (Router returns false, but POST is not passed to requested resource) [sapi/cli/tests/php_cli_server_012.phpt]
No router, no script [sapi/cli/tests/php_cli_server_013.phpt]
Bug #60477: Segfault after two multipart/form-data POST requestes [sapi/cli/tests/php_cli_server_014.phpt]
Bug #60523 (PHP Errors are not reported in browsers using built-in SAPI) [sapi/cli/tests/php_cli_server_015.phpt]
Bug #60591 (Memory leak when access a non-exists file) [sapi/cli/tests/php_cli_server_016.phpt]
Implement Req #60850 (Built in web server does not set $_SERVER['SCRIPT_FILENAME'] when using router) [sapi/cli/tests/php_cli_server_017.phpt]
Implement Req #61679 (Support HTTP PATCH method) [sapi/cli/tests/php_cli_server_018.phpt]
=====================================================================


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-06 07:19 UTC] mike@php.net
-Assigned To: +Assigned To: ardbiesheuvel
 [2013-12-06 07:19 UTC] mike@php.net
Looks like the CLI server just does not work, and maybe some odds at file system related functionality.

IIRC Ard did some ARM related work?
 [2013-12-06 07:24 UTC] ardbiesheuvel@php.net
Which exact OS did you use?
Which version of the C library is that based on?
Which version of the compiler did you use?
 [2013-12-09 12:47 UTC] thuhc at yahoo dot com
I ran aarch64 simulator from guide, you can see it on step 3 and step 4
http://people.linaro.org/~edward.nevill/aarch64/README-cross-compile.html

Build with gcc linaro (glibc 2.17)
gcc (Linaro GCC 4.8-2013.09) 4.8.2 20130902 (prerelease)
 [2013-12-09 16:09 UTC] ardbiesheuvel@php.net
-Summary: Test failed +Summary: CLI server failure on 64-bit ARM (Aarch64) -Status: Assigned +Status: Feedback
 [2013-12-09 16:09 UTC] ardbiesheuvel@php.net
The majority of failures is caused by an issue that causes the CLI server to crash immediately after startup. I have pushed a fix to PHP-5.6 and master to address this issue (cli: don't cast away const in select() timeout argument), but I am not entirely convinced that this fixes it conclusively.

Please try the PHP-5.6 git branch (or master) and share your results here.
 [2013-12-10 10:05 UTC] thuhc at yahoo dot com
-Status: Feedback +Status: Assigned
 [2013-12-10 10:05 UTC] thuhc at yahoo dot com
I tested with  current source:
git clone http://git.php.net/repository/php-src.git

Bug #53879 (DateTime::createFromFormat() fails to parse cookie expiration date)
[ext/date/tests/bug53879.phpt]
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, ba) [ext/date/t
ests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt]
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bs) [ext/date/t
ests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt]
finfo_file(): Testing mime types [ext/fileinfo/tests/finfo_file_002.phpt]
Bug #65304 (Use of max int in array_sum) [ext/standard/tests/array/bug65304.phpt
]
Test strncmp() function : usage variations - binary safe(binary values) [ext/sta
ndard/tests/strings/strncmp_variation6.phpt]
 [2013-12-10 11:15 UTC] ardbiesheuvel@php.net
-Status: Assigned +Status: Feedback
 [2013-12-10 11:15 UTC] ardbiesheuvel@php.net
OK, that looks a whole lot better. I have pushed another fix to address the #65304 regression (Zend: fix overflow handling bug in non-x86 fast_add_function), so the only remaining failure shared between the two runs whose results you have posted is ext/fileinfo/tests/finfo_file_002.phpt.

Any background on those? Care to share the .log?
 [2013-12-12 02:37 UTC] thuhc at yahoo dot com
-Status: Feedback +Status: Assigned
 [2013-12-12 02:37 UTC] thuhc at yahoo dot com
================================================================================
/home/root/php-src/ext/fileinfo/tests/finfo_file_002.phpt
================================================================================
array(8) {
  ["/home/root/php-src/ext/fileinfo/tests/resources/dir.zip"]=>
  string(15) "application/zip"
  ["/home/root/php-src/ext/fileinfo/tests/resources/test.awk"]=>
  string(10) "text/plain"
  ["/home/root/php-src/ext/fileinfo/tests/resources/test.bmp"]=>
  string(14) "image/x-ms-bmp"
  ["/home/root/php-src/ext/fileinfo/tests/resources/test.gif"]=>
  string(9) "image/gif"
  ["/home/root/php-src/ext/fileinfo/tests/resources/test.jpg"]=>
  string(10) "image/jpeg"
  ["/home/root/php-src/ext/fileinfo/tests/resources/test.mp3"]=>
  string(24) "application/octet-stream"
  ["/home/root/php-src/ext/fileinfo/tests/resources/test.pdf"]=>
  string(15) "application/pdf"
  ["/home/root/php-src/ext/fileinfo/tests/resources/test.png"]=>
  string(9) "image/png"
}
================================================================================
013+   string(24) "application/octet-stream"
013-   string(10) "audio/mpeg"
================================================================================

================================================================================
/home/root/php-src/ext/standard/tests/array/bug65304.phpt
================================================================================
int(-9223372036854775808)
float(9.2233720368548E+18)
================================================================================
001+ int(-9223372036854775808)
002- float(%s)
================================================================================
 [2013-12-12 08:47 UTC] ardbiesheuvel@php.net
-Status: Assigned +Status: Closed
 [2013-12-12 08:47 UTC] ardbiesheuvel@php.net
The mimetype issue you are seeing is not caused by PHP but by the underlying OpenEmbedded installation that you are using.

I have built and tested PHP/CLI on Ubuntu Saucy under a QEMU/arm64 chroot, and I get the following failures (out of 7051 executed):

function with many parameters [tests/func/010.phpt]
-> Times out, due to execution overhead of the QEMU emulator

Check cli_process_title support on Unix [sapi/cli/tests/cli_process_title_unix.phpt]
-> Not supported under QEMU

file upload greater than 2G [sapi/cli/tests/upload_2G.phpt]
-> Fails on out of memory condition (on my 8GB machine)

RFC: DateTime and Daylight Saving Time Transitions (zone type 3, ba) [ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt]
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bs) [ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt]
-> Not quite clear to me, but reproducible also on my x86 Ubuntu Saucy installation

So as far as I can tell, there are no arm64 specific issues remaining in this report that are caused by bugs in PHP.

Thanks for the report.
 [2013-12-20 05:11 UTC] thuhc at yahoo dot com
-Status: Closed +Status: Assigned
 [2013-12-20 05:11 UTC] thuhc at yahoo dot com
Hi ardbiesheuvel,

About mimetype issue on test.mp3, I found an issue in ext/fileinfo/libmagic/apprentice.c
protected uint64_t file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
...
             case FILE_BYTE:
                        v = (char) v;
                        break;
...
char is unsigned char by default on ARM (on Intel char is signed char by default) --> invalid mimetype with test.mp3
If I changed code: v = (signed char) v --> it's ok.
 [2014-09-20 17:10 UTC] ogatak at jp dot ibm dot com
Is there any progress on this issue?

I got the same failure in PHP 5.6.0 on Linux PPC64 (RHEL 6.4).

I also verified this failure can be solved by adding "-fsigned-char" GCC option in CFLAGS.  Could you modify configure.in to include this option?
 [2014-09-20 23:43 UTC] ardbiesheuvel@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e64da8c20df3ec28bd2417924b207b870e9ab99f
Log: Fixed bug #66242 (don't assume char is signed)
 [2014-09-20 23:43 UTC] ardbiesheuvel@php.net
-Status: Assigned +Status: Closed
 [2014-09-22 08:28 UTC] ab@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e64da8c20df3ec28bd2417924b207b870e9ab99f
Log: Fixed bug #66242 (don't assume char is signed)
 [2014-10-07 23:13 UTC] stas@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e64da8c20df3ec28bd2417924b207b870e9ab99f
Log: Fixed bug #66242 (don't assume char is signed)
 [2014-10-07 23:24 UTC] stas@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e64da8c20df3ec28bd2417924b207b870e9ab99f
Log: Fixed bug #66242 (don't assume char is signed)
 [2019-02-04 14:11 UTC] sharif dot uddin1 at vodafone dot com
i have problem with 

file upload greater than 2G [sapi/cli/tests/upload_2G.phpt]


but i have 12GB of free ram. i am using centos 7.5 and tryign to build php7.3.x with configure options

./configure --enable-fpm --with-fpm-systemd --enable-zip --with-libzip --with-zlib --with-bz2 --with-curl --with-gd --with-openssl --with-ldap --with-libdir=lib64 --enable-mbstring --prefix=/opt/SP/php-7.3.1 --with-pcre-regex --quiet
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 01:01:29 2024 UTC