Commit Graph

532 Commits

Author SHA1 Message Date
Arnaud Le Blanc
a11c8a3039
Limit stack size (#9104) 2022-12-16 17:44:26 +01:00
Pierrick Charron
002d54db9f
PHP-8.2 is now for PHP 8.2.2-dev 2022-12-13 19:29:29 -05:00
Ben Ramsey
696bb385df
PHP-8.1 is now for PHP 8.1.15-dev 2022-12-07 11:29:37 -06:00
David CARLIER
3660bc31de opcache fixing w/x pages creation on freebsd 13.1 and above.
By default, the system allows these but admin can disable them system wide.
However the procctl api permits to control it per process.

Closes GH-9896.
2022-11-18 19:22:00 +00:00
Dmitry Stogov
05f4b84940 Fix cross-compilation for shadow_stack_exists 2022-11-17 15:39:43 +03:00
Pierrick Charron
44d652c00a
PHP-8.2 is now for PHP 8.2.1-dev and prepare NEWS for 8.2.0 2022-11-08 13:26:35 -05:00
Patrick Allaert
540488c74e
PHP-8.1 is now for PHP 8.1.14-dev 2022-11-08 17:57:34 +01:00
Bob Weinand
b3f3414ce9 Merge branch 'PHP-8.2' 2022-11-07 16:43:24 +01:00
Bob Weinand
5d7b64be1d Fix cross-compilation for copy_file_range 2022-11-07 16:39:08 +01:00
Chen, Hu
37b84b7e32
Fiber: add shadow stack support
Shadow stack is part of Intel's Control-Flow Enforcement Technology (CET).

Whenever a function is called, the return address is pushed onto both
the regular stack and the shadow stack. When that function returns, the
return addresses are popped off both stacks and compared; if they fail
to match, #CP raised.

With this commit, we create shadow stack for each fiber context and
switch the shadow stack accordingly during fcontext switch.

Signed-off-by: Chen, Hu <hu1.chen@intel.com>

Closes GH-9283.
2022-11-07 14:48:27 +01:00
Jakub Zelenka
b8d013a48d
Merge branch 'PHP-8.2' 2022-10-23 12:41:51 +01:00
Jakub Zelenka
b732d80329
Fix bug GH-9779: stream_copy_to_stream fail when dest in append mode 2022-10-23 12:40:22 +01:00
Ben Ramsey
865161af33
PHP-8.1 is now for PHP 8.1.13-dev 2022-10-11 19:47:00 -04:00
David Carlier
f9f9e7f053 Merge branch 'PHP-8.2' 2022-10-11 21:48:46 +01:00
David Carlier
c15fe51918 Fix GH-9653: does not inconditionally support copy_file_range on older kernels.
As mentioned in its manpage, it had been reworked in the 5.3 line to support cross filesystem interactions.
Closes #GH-9656
2022-10-11 21:47:34 +01:00
David Carlier
43f5165e89 Fix GH-9566: disable assembly for Fiber on FreeBSD i386.
preparing in case there is more architectures especially the not tested.
2022-10-10 12:32:49 +01:00
David Carlier
8e146c8806 Merge branch 'PHP-8.1' into PHP-8.2 2022-10-10 12:31:57 +01:00
David Carlier
be53e5e5bb Fix GH-9566: disable assembly for Fiber on FreeBSD i386.
preparing in case there is more architectures especially the not tested.
2022-10-10 12:31:38 +01:00
Ilija Tovilo
138fd5b3c8
Replace reallocarray with safe_perealloc
Fixes GH-9581
2022-09-29 15:15:40 +02:00
Ilija Tovilo
b61c81c949
Replace reallocarray with safe_perealloc (#9593) 2022-09-22 14:55:41 +02:00
Patrick Allaert
0f575aa698
PHP-8.1 is now for PHP 8.1.12-dev 2022-09-13 23:09:47 +02:00
Ilija Tovilo
ecc3fc180f
Use PDEATHSIG to kill cli-server workers if parent exists
Closes GH-9476
2022-09-08 10:48:20 +02:00
Dominic H
cb4e8ff2b8
[ci skip] Fix typo in configure.ac (build → built)
Closes GH-9495.
2022-09-07 17:17:58 +02:00
Pierrick Charron
327c95237c
Prepare for PHP 8.3 2022-08-30 11:17:15 -04:00
Ben Ramsey
7f26661993
PHP-8.1 is now for PHP 8.1.11-dev 2022-08-16 10:45:29 -05:00
David CARLIER
099b16800c GH-9157: opcache fix build on older macOs releases.
Closes #9158.
2022-07-27 09:37:54 +01:00
Patrick Allaert
9af3327176
PHP-8.1 is now for PHP 8.1.10-dev 2022-07-20 06:48:52 +02:00
David CARLIER
1416961505 opcache JIT support improvements attempts on macOs.
for cases when shared segments switch b/w R/W/X and R/X bits.

Closes #8382.
2022-07-19 13:41:33 +01:00
David CARLIER
bf29ee6917 Add reallocarray implementation.
In a similar model as _safe_*alloc api but for the `userland` it guards
against overflow before (re)allocation, usage concealed in fpm for now.
Modern Linux and most of BSD already have it.
Closes #8871.
2022-06-26 13:10:13 +01:00
Ben Ramsey
f3b45e74f5
PHP-8.1 is now for PHP 8.1.9-dev 2022-06-21 11:03:50 -05:00
David Carlier
bfe6f9e66a Introduction of timing attack safe bcmp implementation.
Nothing new but to refactor usage b/w hash and password
extensions but using volatile pointers to be a bit safer,
allowing to expand its usage eventually.
2022-06-20 16:30:30 +01:00
David Carlier
d677cc13ce Add SO_BPF_EXTENSIONS flag to socket.
Returns the supported bpf extensions from the kernel. Linux only.
Closes GH-8713.
2022-06-08 05:14:57 +01:00
Levi Morrison
280fd680c8
Make vm_interrupt and timed_out atomic (#8327)
This is done by adding a new zend_atomic_bool type. The type
definition is only available for compiler alignment and size info; it
should be treated as opaque and only the zend_atomic_bool_* family of
functions should be used.

Note that directly using atomic_bool is complicated. All C++ compilers
stdlibs that I checked typedef atomic_bool to std::atomic<bool>, which
can't be used in an extern "C" section, and there's at least one usage
of this in core, and probably more outside of it.

So, instead use platform specific functions, preferring compiler
intrinsics.
2022-06-01 09:43:25 -06:00
David Carlier
30c8f3a80f
Fix GH-8674: sockets extension won't build for older Linux kernels
In abscence of the needed header, disable the feature altogether.

Closes GH-8677.
2022-06-01 17:33:36 +02:00
Calvin Buckley
2920a26636
Quote when adding to connection string in (PDO_)ODBC
Because the UID= and PWD= values are appended to the SQLDriverConnect
case when credentials are passed, we have to append them to the string
in case users are relying on this behaviour. However, they must be
quoted, or the arguments will be invalid (or possibly more injected).
This means users had to quote arguments or append credentials to the raw
connection string themselves.

It seems that ODBC quoting rules are consistent enough (and that
Microsoft trusts them enough to encode into the .NET BCL) that we can
actually check if the string is already quoted (in case a user is
already quoting because of this not being fixed), and if not, apply the
appropriate ODBC quoting rules.

This is because the code exists in main/, and are shared between
both ODBC extensions, so it doesn't make sense for it to only exist
in one or the other. There may be a better spot for it.

Closes GH-8307.
2022-05-27 16:56:44 +02:00
George Peter Banyard
8685a7f03c
Remove custom alloca() (#8513)
* Use arena in DCE instead of multiple alloca()
  This requires passing the optimizer context

* Use our do_alloca() instead of alloca()

* Use emalloc in DEBUG builds instead of stack allocations for do_alloca()
  This helps detecting that we correctly free do_alloca()
2022-05-27 09:05:33 +01:00
Patrick Allaert
3b6ee1eb19
Bump for 8.1.8-dev 2022-05-25 00:54:00 +02:00
Christoph M. Becker
81d1a1b47b
Update bug tracker links
The new php-src bugtracker is on Github.

Closes GH-8277.
2022-05-12 14:55:11 +02:00
Ben Ramsey
fb819faa4e
Prepare for PHP 8.1.7 2022-04-26 19:22:15 -05:00
Max Kellermann
fa6d97db5d
main/streams/streams: use copy_file_range() on Linux (#8413)
copy_file_range() is a Linux-specific system call which allows
efficient copying between two file descriptors, eliminating the need
to transfer data from the kernel to userspace and back.  For
networking file systems like NFS and Ceph, it even eliminates copying
data to the client, and local filesystems like Btrfs and XFS can
create shared extents.
2022-04-23 13:32:05 +01:00
Max Kellermann
d87ba95acd
sapi/*: move duplicate "--define" code to library 2022-04-18 16:52:08 +02:00
Patrick Allaert
5a899563cc
Bump for 8.1.6-dev 2022-03-31 17:37:41 +02:00
Christoph M. Becker
6b2187bc79
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8160: ZTS support on Alpine is broken
2022-03-11 14:42:49 +01:00
Christoph M. Becker
0b1bca6b9c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8160: ZTS support on Alpine is broken
2022-03-11 14:41:46 +01:00
Michael Voříšek
2b2aeb989e
Fix GH-8160: ZTS support on Alpine is broken
We need to export `__MUSL__` so that phpize builds can see the proper
macro, and also need to fix "_tsrm_ls_cache" usage for musl.

Closes GH-8180.
2022-03-11 14:39:39 +01:00
Patrick Allaert
723058c3bf
Bump for 8.1.5-dev 2022-03-02 17:38:22 +01:00
Patrick Allaert
8db7fd8a2a
Bump for 8.1.4-dev 2022-02-03 02:21:29 +01:00
Sara Golemon
8a46311dbd
Bump for 8.0.17-dev 2022-02-02 23:44:02 +00:00
Patrick Allaert
4ae75623fd
Preparing for 8.1.3-dev 2022-01-04 19:29:41 +01:00
Christoph M. Becker
f2fa8753fa
Merge branch 'PHP-8.1'
* PHP-8.1:
  riscv64 support for fibers
2022-01-04 12:08:38 +01:00
Jeremie Courreges-Anglas
70b02d75f2
riscv64 support for fibers
We add riscv64 assembly files from Boost, needed for fibers support,
and hook up riscv64 fibers support during configure.

Closes GH-7879.
2022-01-04 12:06:37 +01:00
David CARLIER
1a4d2dd962
zend alloc USE_ZEND_ALLOC_HUGE_PAGES option support on solaris based systems (#7789) 2021-12-21 07:18:11 +01:00
Patrick Allaert
628670c391
Prepare for 8.1.2 2021-12-02 14:20:36 +01:00
Sara Golemon
999c6f2c5d
Bump for 8.0.15 2021-12-02 05:09:07 +00:00
Patrick Allaert
ac96db6767
Preparing for 8.1.1 2021-11-27 11:06:14 +01:00
Dmitry Stogov
067df26344 Use memrchr() when available
On x86_64 glibc memrchr() uses SSE/AVX CPU extensions and works much
faster then naive loop. On x86 32-bit we still use inlined version.

memrchr() is a GNU extension. Its prototype  becomes available when
<string.h> is included with defined _GNU_SOURCE macro. Previously, we
defined it in "php_config.h", but some sources may include <string.h>
befire it. To avod mess we also pass -D_GNU_SOURCE to C compiler.
2021-11-24 16:13:34 +03:00
Ben Ramsey
89f28fafca
The PHP-8.1 branch is now for 8.1.0 2021-11-09 17:49:14 -06:00
Sara Golemon
2d4bfcfd3b
Prep for 8.0.14 2021-11-02 15:55:12 +00:00
Patrick Allaert
5dc2c38faf
Configuring for 8.1.0RC6 2021-10-27 02:15:21 +02:00
Ben Ramsey
daf6a46177
The PHP-8.1 branch is now for 8.1.0RC5 2021-10-12 18:50:51 -05:00
Nikita Popov
fe9abf52fa Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix bug #75941: Fix compile failure on Solaris with clang
2021-09-29 11:46:23 +02:00
Jaromir Dolecek
26d28c3b42 Fix bug #75941: Fix compile failure on Solaris with clang
Closes GH-7525.
2021-09-29 11:44:47 +02:00
Ben Ramsey
68ee1b40fc
The PHP-8.1 branch is now for 8.1.0RC4 2021-09-28 16:34:46 -05:00
Nikita Popov
74033b2cc6 Don't hardcode used sanitizers in fuzzer
Now that we have generic --enable-address|undefined|memory-sanitizer
options, let the user pick one of these instead of making the fuzzer
enable one implicitly.
2021-09-15 16:07:26 +02:00
Patrick Allaert
cba708bbb6
Configuring for 8.1.0RC3 2021-09-14 18:17:42 +02:00
Sara Golemon
5e1e4a8963
Prep for 8.0.12 2021-09-07 15:16:11 +00:00
Patrick Allaert
d6d6491153
Preparing for 8.1.0RC2 2021-09-01 18:22:32 +02:00
Nikita Popov
27901e0f6a Restore dev version 2021-09-01 09:56:54 +02:00
Patrick Allaert
1c33ddb5e5
Prepare for PHP 8.2 2021-08-31 19:13:49 +02:00
Patrick Allaert
5764414eb8
Prepare for PHP 8.1.0RC1 2021-08-31 18:57:44 +02:00
Calvin Buckley
ea604f0917
AIX/XCOFF support for fibers (#7338) 2021-08-16 17:05:58 -05:00
Joe Watkins
00c668a15d
Drop TsHashTable (#7351) 2021-08-08 10:45:44 +02:00
Sara Golemon
7dc35ac8a7
Bump to 8.0.10 2021-07-13 14:10:35 +00:00
Aaron Piotrowski
8fd747a2a0
Fiber ucontext support (#7226)
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
2021-07-11 15:40:11 -05:00
Joe Watkins
39a54e2c31
Fix #81202 powerpc64 build fails on fibers 2021-06-26 15:39:39 +02:00
Gabriel Caruso
b81c3b5b1c
Prepare for PHP 8.0.9 2021-06-15 09:19:13 +02:00
Joe Watkins
a297c66cfb
Fix #81136 opcache header not installed, causing shared build to fail 2021-06-14 11:09:36 +02:00
Anatol Belski
b9f3f35d4a
libtool: Add CC tag explicitly
This fixes the scan-build build. CC is also the default tag, so there
should be no impact anywhere.

Signed-off-by: Anatol Belski <ab@php.net>
2021-05-26 22:41:50 +02:00
Derick Rethans
b624473b3e Merge branch 'PHP-8.0' 2021-05-21 09:03:31 +01:00
Derick Rethans
804420b011 Detect musl libc to not set tls_model attribute on that platform
This fixes:
``_tsrm_ls_cache: initial-exec TLS resolves to dynamic definition``
in shared extensions.
2021-05-21 09:02:46 +01:00
Sara Golemon
64918fee97
Prep for 8.0.8 2021-05-19 19:18:56 +00:00
Sara Golemon
f020d537b0
Reset for 8.0.7 2021-05-04 17:17:20 +00:00
Aaron Piotrowski
f3465e6740
Minor fiber fixes
Assert error is fatal when calling zend_error_suspend_fiber.

Added missing static.

Removed .S extension from output of configure.
2021-04-30 10:08:01 -05:00
Nikita Popov
39e1af662b Fix out-of-tree build
Add Zend/asm as a build directory.
2021-04-29 10:13:47 +02:00
Aaron Piotrowski
c276c16b66
Implement Fibers
RFC: https://wiki.php.net/rfc/fibers

Closes GH-6875.
2021-04-26 11:07:06 -05:00
David CARLIER
7aba6de1d0
stream: Fix MacOS build. fsync as alias for fdatasync. (#6882)
If fdatasync is not available, use fsync instead.

For some reason, fdatasync is available when using clang from Xcode, even though no declaration is present in headers.
2021-04-21 16:21:43 +02:00
Dmitry Stogov
f1ad9199ef Better support for cross-compilation 2021-04-16 17:28:54 +03:00
twosee
122deea506
Add ASan and UBSan options (#6825)
When we need to enable ASan/UBSan in PHP extension, we also need to enable it in PHP kernel. Providing these options makes it easier for us to enable ASan/UBSan when compiling PHP.
And we use --enable-address-sanitizer and --enable-undefined-sanitizer in azure-pipelines.yml instead of changing CFLAGS manually.
We also add compile flag check to MSan.
2021-04-16 12:41:25 +08:00
Gabriel Caruso
79872ac9c2
8.0.6 is the next version 2021-04-13 12:41:21 +02:00
Nikita Popov
d58cab06c6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Disable ifunc support on openbsd
2021-04-12 11:28:29 +02:00
Nikita Popov
6700198d64 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Disable ifunc support on openbsd
2021-04-12 11:28:24 +02:00
David Carlier
a04fac84e7 Disable ifunc support on openbsd
Enabling it leads to segfault when resolvers are used e.g.
php_stripslashes.

Closes GH-6851.
2021-04-12 11:27:50 +02:00
Ilija Tovilo
269c8dac1d
Implement enums
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6489.
2021-03-17 19:08:03 +01:00
Christoph M. Becker
c7fadd2328 8.0.5 is next
We also move the NEWS entry for bug 80847 to the proper version.
2021-03-17 12:14:26 +01:00
Nikita Popov
fa9e2b31b8 Check for php program in autoconf
Use the detected PHP (minimum 7.1) to run gen_stubs, and other
code generation scripts in the future.
2021-03-16 12:30:56 +01:00
Derick Rethans
4adc08a403 Fix build version too 2021-03-16 09:41:21 +00:00
Sara Golemon
8c6db654e7
Prep for 8.0.4 2021-02-17 15:24:43 +00:00
Derick Rethans
6d3d9104e6 PHP-7.4 is now 7.4.17-dev 2021-02-16 11:26:47 +00:00
Nikita Popov
83be073abe Move optimizer into core
This only moves the files, adjusts the build system, exports APIs
and does minor fixups to make sure the code builds.

This does not yet try to make the optimizer usable independently
of opcache.

Closes GH-6642.
2021-01-28 10:38:25 +01:00
Gabriel Caruso
34f0f60db5
Next is 8.0.3 2021-01-19 13:00:48 -03:00
Derick Rethans
a33d0c3aae Update NEWS and version 2021-01-19 14:58:38 +00:00
Christoph M. Becker
91eb9a1383 Merge branch 'PHP-8.0'
* PHP-8.0:
  Revert fix for bug 76813 and re2c version bump
2021-01-11 17:21:42 +01:00
Christoph M. Becker
95a13ca989 Revert fix for bug 76813 and re2c version bump
CentOS 7 ships with re2c 0.13.5 by default, so we should not have
bumped the required re2c version to 0.13.7.  However, 0.13.5 does not
support default rules, so we cannot use them to fix bug 76813.

This reverts commit 420184ad52 and
5e15c9c41f.

Closes GH-6593.
2021-01-11 17:19:52 +01:00
Remi Collet
9bf43c4590 rename COMPILER and ARCHITECTURE macro (too generic) 2021-01-04 10:13:54 +01:00
Christoph M. Becker
e4e318bad3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Bump minimum re2c version to 0.13.7
2020-12-28 13:44:00 +01:00
Christoph M. Becker
420184ad52 Bump minimum re2c version to 0.13.7
Closes GH-6516.
2020-12-28 13:43:31 +01:00
Gabriel Caruso
9eea9aae10
Prepare for PHP 8.0.2
This was missing from f1f78ac875.
2020-12-15 11:03:21 -03:00
Levi Morrison
36ff92e6fb Remove very old -no-cpp-precomp compatibility flag on Mac
Closes GH-6501.
2020-12-15 10:19:26 +01:00
Nikita Popov
7db29d2186 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80377
2020-11-25 11:48:51 +01:00
Nikita Popov
4633e70ab1 Fixed bug #80377
Make sure the $PHP_THREAD_SAFETY variable is always available
when configuring extensions. It was previously available for
phpized extensions, but for in-tree builds it was being set
too late.

Then, use $PHP_THREAD_SAFETY instead of $enable_zts to check for
ZTS in bundled extensions, which makes sure these checks also
work for phpize builds.
2020-11-25 11:47:05 +01:00
Sara Golemon
3c44e9c080 8.0 branch should be prepping for 8.0.1 2020-11-19 14:37:44 +00:00
Derick Rethans
25643b56a2 Update version in 7.4 branch 2020-11-07 18:48:13 +00:00
Gabriel Caruso
14806e0824
Prepare for PHP 8.1
Closes GH-6305.
2020-10-09 11:37:27 +02:00
Nikita Popov
d3cf597328 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix -Wimplicit-function-declaration in configure
2020-10-05 10:48:04 +02:00
Nikita Popov
9ad5381a2f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix -Wimplicit-function-declaration in configure
2020-10-05 10:46:46 +02:00
Nikita Popov
aa405b7da2 Fix -Wimplicit-function-declaration in configure
As this is an error with xcode 12, see bug #80171.
2020-10-05 10:43:58 +02:00
Sammy Kaye Powers
12306728c5
Add system ID entropy API
The `zend_system_id` is a (true global) system ID that fingerprints a process state. When extensions add engine hooks during MINIT/startup, entropy is added the system ID for each hook. This allows extensions to identify that changes have been made to the engine since the last PHP process restart.

Closes GH-5871
2020-09-18 14:26:44 -07:00
Christoph M. Becker
edddddcea8 7.3.24 is next 2020-09-15 10:51:41 +02:00
Dmitry Stogov
aae50328e2 decbin/decoct/dechex optimization. 2020-09-08 10:34:29 +03:00
Frank Du
c3299d7dab X86: Fast CRC32 computation using PCLMULQDQ instruction
Based on:
"Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction"
V. Gopal, E. Ozturk, et al., 2009, http://intel.ly/2ySEwL0

Signed-off-by: Frank Du <frank.du@intel.com>

Closes GH-6018
2020-09-02 15:10:41 +02:00
Levi Morrison
66c3e900e2 Add zend_observer API
Closes GH-5857.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Co-authored-by: Sammy Powers <sammyk@datadoghq.com>
2020-09-01 09:59:59 -06:00
David Carlier
32c6a0bbbb further network libraries detection for Haiku system.
Closes GH-5997.
2020-08-24 11:37:48 +02:00
Christoph M. Becker
ff14b7adad 7.3.23 is next 2020-08-18 09:55:37 +02:00
Derick Rethans
499bf91cd0 Prepare for 7.4.11 2020-08-18 08:06:20 +01:00
Nikita Popov
0d836a39a7 Revert "Prepare for PHP 8.1"
This reverts commit 1ab4d0e6b7.
This reverts commit a359635cb1.
2020-08-04 22:24:44 +02:00
Gabriel Caruso
a359635cb1
Prepare for PHP 8.1 2020-08-04 18:46:14 +02:00
Nikita Popov
e2f39f84e2 Remove PHP_CHECK_GCC_ARG()
In favor of AX_CHECK_COMPILE_FLAG(), which we bundle since at least
PHP 7.

Closes GH-5904.
2020-07-29 15:07:53 +02:00
Derick Rethans
973be68c63 Prepare for 7.4.10 2020-07-21 09:23:51 +01:00
Christoph M. Becker
2c0a6977dd 7.3 is now 7.3.22-dev 2020-07-21 09:18:07 +02:00
Remi Collet
4884f1be85 define COMPILER and ARCHITECTURE from environment 2020-07-13 11:14:02 +02:00
Remi Collet
ad0d2e438f display info about system used to build and its provider 2020-07-06 10:54:43 +02:00
Nikita Popov
6838ebb1a8 Remove unnecessary ieeefp.h include
This was needed when php_config.h also declare compatibility
shims for isinf() and friends. These are no longer present in
master, so drop this include.
2020-06-30 15:54:47 +02:00
Eddie Kohler
ff69a8a789 Move __alignof__ support check into main configure.ac. 2020-06-30 14:26:48 +02:00
David Carlier
1cbb62e82d Haiku proc_open build fix, *pty api resides on the BSD library
Closes GH-5770.
2020-06-26 12:06:21 +02:00
Nikita Popov
7d05bc8630 Fix crypt_r detection
And force use of our own php_crypt_r implementation to keep
previous behavior despite that.
2020-06-24 12:09:49 +02:00
Alex Dowad
7a9f0cc3d0 Simplify _crypt_extended_init_r, and fix redundant initialization on Win32/Solaris
Looking at the history of this function, the original implementation had a bug where
it would return from the middle of the function without unlocking the mutex first.
The author attempted to fix this by incrementing the `initialized` flag atomically,
which is not necessary, since the section which modifies the flag is protected by a
mutex.

Coincidentally, at the same time that all this unnecessary 'atomic' machinery was
introduced, the code was also changed so that it didn't return without unlocking the
mutex. So it looks like the bug was fixed by accident.

It's not necessary to declare the flag as `volatile` either, since it is protected
by a mutex.

Further, the 'fixed' implementation was also wrong in another respect: on Windows
and Solaris, the `initialized` flag was not even declared as `static`!! So the
initialization of the static tables for S-boxes, P-boxes, etc. was repeated on
each call to `php_crypt`, completely defeating the purpose of this function.
2020-06-23 16:10:54 +02:00
Christoph M. Becker
91982bad63 7.3 is now 7.3.21-dev 2020-06-23 10:29:42 +02:00
Derick Rethans
13f9f874a7 PHP-7.4 is now 7.4.9-dev 2020-06-23 08:46:37 +01:00
Alex Dowad
7e2147be23 Clean up some unused code (and fix some comments) in build scripts
- Fix typo in build/php.m4

- Nothing uses HAVE_INTTYPES_H; so remove check for header file

- Nothing defines ZEND_ACCONFIG_H_NO_C_PROTOS; so remove #ifndef

- `format_money` was removed in 2019, so <monetary.h> no longer needed

- Nothing uses HAVE_NETDB_H; so remove check for header file

- Nothing checks HAVE_TERMIOS_H; so remove check for header file

    (This was actually added when Wez Furlong was adding the original implementation of
    PTY support in `proc_open`, since replaced.)

- Nothing checks HAVE_SYS_AUXV_H; so remove check for header file

- PHP_BUILD_DATE variable is not used for anything, so remove it

    This variable was added to the Makefile, but from there, was not used for anything.
    The comments suggest it was intended to allow 'reproducible builds'. Presumably,
    this means that if a bug is found in a PHP binary somewhere, one could look at the
    Makefile which it was built from, see the date, and then could check the same
    code version out from source control. But... there can easily be multiple commits
    to the repo in the same day. Also, what makes us think that the Makefile which a
    binary was built from will be easily available?

    Besides, ext/standard/info.c already embeds the build date and time in each binary...
    but it does it using `__DATE__` and `__TIME__` (see `php_print_info`).

- Nothing checks HAVE_FINITE; so don't check for function

- Grammar fix to comment in build/php.m4

- Nothing sets $php_ldflags_add_usr_lib variable in configure, so remove conditional

    This was added in 2002, when Rasmus was having difficulty building PHP on some
    host and needed to have /usr/lib in the rpath. It was never documented and
    probably has never been used by anyone else.
2020-06-19 22:04:52 +02:00
David Carlier
bb61346580 Fix Haiku build
getrusage supports only two fields. The network api sits in the network lib.

Closes GH-5732.
2020-06-19 17:21:55 +02:00
Alex Dowad
3a19726bce Remove unneeded --disable-inline-optimization build parameter
In 1999, inline optimization was turned off by default. The commit log indicates this was
done because GCC was running out of memory on some hosts when building the Zend executor.
In 2003, inline optimization was re-enabled by default, but a build option was added to
turn it off if one runs out of memory when building.

Computing hardware has come a long way since 2003 and I doubt that anyone is running out
of memory when building PHP now.

Interestingly, this code set an unused variable called `INLINE_CFLAGS`. It actually
disabled inline optimization by adding -O0 to the build command, not using `INLINE_CFLAGS`.

Just to see how much memory GCC/Make are using when building PHP, I tried building with
successively higher values of `ulimit -v` until it succeeded. Interestingly, while most
of the codebase can be built with about 400MB of memory, ext/fileinfo/libmagic/apprentice.c
requires 1.2GB, doubtless because it includes ext/fileinfo/data_file.c, which is more
than 350,000 lines long. That is with GCC 7.5.0.

Most users get PHP as a binary package anyways, so the question is, are *packagers*
of PHP trying to build on machines with just 1GB RAM? And would they want to package
a PHP interpreter built with *no optimizations*? I can't imagine either being true.
2020-06-17 19:31:35 +02:00
Nikita Popov
1d8233877c Merge branch 'PHP-7.4'
* PHP-7.4:
  Allow defining of uname value for reproducible builds
2020-06-07 10:38:50 +02:00
Jelle van der Waa
d21b1c5679 Allow defining of uname value for reproducible builds
Extend configure.ac to accept PHP_UNAME as env variable to set the value of the
PHP_UNAME define in a reproducible manner. This allows distributions to set a
fixed value for php_uname and keep the default behaviour if PHP_UNAME is not
set.

Motivation: https://reproducible-builds.org/

Closes GH-5671.
2020-06-07 10:38:43 +02:00
Benjamin Eberlei
a7908c2d11 Add Attributes
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
2020-06-04 18:19:49 +02:00
Christoph M. Becker
c249f593ef 7.3.20 will be next 2020-05-26 10:53:22 +02:00
Nikita Popov
e852944f63 Add --enable-memory-sanitizer flag
This flag enabled msan late in the pipeline, so that it does
not affect configure checks.

Otherwise we get a false positive report for openpty availability
without -lutil, which will then result in infinite recursion if
actually called.

This also sets origin tracking to 2, so bump the timeout to 90
minutes.
2020-05-20 16:46:28 +02:00
Christoph M. Becker
c4badcbec4 Bump version
Seems that has been forgotten.
2020-05-19 17:24:18 +02:00
Alex Dowad
a84cd96e86 Add PTY support to proc_open (again after 16 long years)
Back in 2004, a feature was added to proc_open which allowed it to open a PTY,
connecting specific FDs in the child process to the slave end of the PTY and returning
the master end of the PTY (wrapped as a PHP stream) in the `$pipes` array. However,
this feature was disabled just about a month later. Little information is available
about why this was done, but from talking to the original implementer, it seems there
were portability problems with some rare flavors of Unix.

Re-enable this feature with a simplified implementation which uses openpty(). No
attempt is made to support PTYs if the platform does not have openpty(). The configure
script checks if linking with -lutil is necessary to use openpty(), but if anything
else is required, like including some special header or linking with some other library,
PTY support will be disabled.

The original PTY support for proc_open automatically daemonized the child process
(disassociating it from the TTY session and process group of the parent). However,
I don't think this is a good idea. Just because a user opens a child process in a
PTY, it doesn't mean they want it to continue running even when the parent process
is killed. Of course, if the child process is some kind of server, it will likely
daemonize itself; but we have no reason to preempt that decision.

It turns out that since 2015, there has been one test case for PTY support in
proc_open() in the test suite. This test was added in GitHub PR #1588
(https://github.com/php/php-src/pull/1588). That PR mentioned that the PHP
binary in the Debian/Ubuntu repositories is patched to *enable* PTY support. Checking
the Debian PHP repository (https://salsa.debian.org/php-team/php.git) shows that this
is still true. Debian's patch does not modify the implementation from 2004 in any
way; it just removes the #if 0 line which disables it.

Naturally, the test case is skipped if PTY support is not enabled. This means that ever
since it was added, every test run against the 'vanilla' PHP codebase has skipped it.

Interestingly, the test case which was added in 2015 fails on my Linux Mint PC... both
with this simplified implementation *and* when enabling the original implementation.
Investigation reveals the reason: when the child process using the slave end of the
PTY exits and its FDs are all closed, and all buffered data is read from the master
end of the PTY, any further attempt to read from the master end fails with EIO. The
test case seems to expect that reading from the master end will always return an
empty string if no data is available.

Likely this is because PHP's fread() was updated to report errors from the underlying
system calls only recently.

One way out of this dilemma: IF at least one FD referring to the slave end of the PTY is
kept open *in the parent process*, the failure with EIO will not occur even after the child
process exits. However, that would raise another issue: we would need a way to ensure the FD
will be closed eventually in long-running programs.

Another discovery made while testing this code is that fread() does not always return
all the data written to the slave end of the PTY in a single call, even if the data was
written with a single syscall and it is only a few bytes long.

Specifically, when the child process in the test case writes "foo\n" to the PTY, the parent
sometimes receives "foo" (3 bytes) and sometimes "foo\r\n" (5 bytes). (The "\r" is from the
TTY line discipline converting "\n" to "\r\n".) A second call to fread() does return the
remaining bytes, though sometimes all the data is read in the first call, and by the time
the second call is made, the child process has already exited. It seems that liberal use
of the @ operator is needed when using fread() on pipes.

Thanks to Nikita Popov for suggesting that we should just use openpty() rather than
grantpt(), unlockpt(), etc.
2020-05-14 10:25:37 +02:00
Nikita Popov
ae5ca5459f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix lcov genhtml: ERROR: cannot read [file]
  Properly detect CRC32 APIs on aarch64 from configure
2020-05-14 09:39:03 +02:00
Ondřej Surý
d4bebc874b Properly detect CRC32 APIs on aarch64 from configure
The CRC32 APIs are optional for armv8-a. They became mandatory since
armv8.1-a.

Closes GH-5564.
2020-05-14 09:38:05 +02:00