Commit Graph

43 Commits

Author SHA1 Message Date
Arnaud Le Blanc
385151d200
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix build on platforms without JIT support (#15069)
2024-07-23 13:43:13 +02:00
Arnaud Le Blanc
acf758d2ea
Fix build on platforms without JIT support (#15069) 2024-07-23 13:42:47 +02:00
Arnaud Le Blanc
ead61c7f29
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Hint the opcache shm mapping location only when JIT is enabled
  Fix the JIT buffer relocation failure at the corner case (#11266)
2024-07-22 19:28:05 +02:00
Arnaud Le Blanc
929536b697
Hint the opcache shm mapping location only when JIT is enabled
Closes GH-14793
Fixes GH-13775
2024-07-22 19:26:54 +02:00
LoongT4o
a924e1c71b
Fix the JIT buffer relocation failure at the corner case (#11266)
Avoid missing possible candidates due to the large address range of the free segment.
Eg, 

48000000-49400000 r-xs 08000000 00:0f 39322841               segment1
7ffff2ec8000-7ffff2f49000 rw-p 00000000 00:00 0              segment2
7ffff6fae000-7ffff735c000 r-xp 00200000 08:02 11538515       /usr/local/sbin/php-fpm

original code will miss the opportunity between [7ffff2ec** - 7ffff2ec8000].

Fix issue #11265.

Signed-off-by: Long, Tao <tao.long@intel.com>
Signed-off-by: Dmitry Stogov <dmitrystogov@gmail.com>
2024-07-22 19:17:43 +02:00
Bob Weinand
35aef8ee87 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 17:22:23 +01:00
Bob Weinand
6fb8b9d721 Fix possible segfault with 0x0 shared opcache base
Moving the minimum base of the shared opcache memory to the second huge page to avoid a possible 0x0 base, which may cause all sorts of segfaults.
This is not a problem on most systems which have a mmap_min_addr which is non-zero, but e.g. WSL1 doesn't have a minimum mapping address.
2024-03-18 17:18:33 +01:00
Ilija Tovilo
5cbcc10c6c
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Remove MAP_JIT flag
2024-03-09 23:09:13 +01:00
Ilija Tovilo
00f9c5eeb4
Remove MAP_JIT flag
This flag is supposed to go on the flags parameter, rather than prot. Moreover,
this flag is no longer needed because the JIT does not set RWX without ZTS, and
JIT+ZTS has been disabled on macOS with Apple Silicon.

Closes GH-13638
2024-03-09 23:08:44 +01:00
Ilija Tovilo
719236e3ec
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix SELinux mprotect execheap error due to mem adjacent to heap
2023-12-13 11:26:23 +01:00
Ilija Tovilo
7cf1a2ad9d
Fix SELinux mprotect execheap error due to mem adjacent to heap
It seems SELinux has a bug where memory directly adjacent to the heap is
interpreted as heap memory. Dodge this issue by leaving some space between the
heap and memory suggested by find_prefered_mmap_base.

See GH-12932
See https://bugzilla.kernel.org/show_bug.cgi?id=218258
Closes GH-12942
2023-12-13 11:25:48 +01:00
Ilija Tovilo
8524da6d30
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix asan shadow memory and shared_alloc_mmap clash
2023-12-07 18:29:14 +01:00
Ilija Tovilo
53909896e0
Fix asan shadow memory and shared_alloc_mmap clash
The memory region found by find_prefered_mmap_base may clash with memory regions
reserved by asan for tracking memory. The symptom of this is that mprotect for
JIT fails adding the PROT_EXEC flag to the shared memory region.

Closes GH-12890
2023-12-07 18:28:21 +01:00
LoongT4o
a2af8ac371
Fix the JIT buffer relocation failure at the corner case (#11266)
Avoid missing possible candidates due to the large address range of the free segment.
Eg, 

48000000-49400000 r-xs 08000000 00:0f 39322841               segment1
7ffff2ec8000-7ffff2f49000 rw-p 00000000 00:00 0              segment2
7ffff6fae000-7ffff735c000 r-xp 00200000 08:02 11538515       /usr/local/sbin/php-fpm

original code will miss the opportunity between [7ffff2ec** - 7ffff2ec8000].

Fix issue #11265.

Signed-off-by: Long, Tao <tao.long@intel.com>
Signed-off-by: Dmitry Stogov <dmitrystogov@gmail.com>
2023-05-23 14:49:19 +03:00
Max Kellermann
263b22f374
Make lots of string pointers const (#10646)
This allows using string literals without implicitly casting away the
`const`.
2023-02-21 14:01:37 +00:00
Max Kellermann
d3facbe283
Mark globals as const (#10303)
This moves them from ``.data`` to ``.rodata`` and allows more compiler optimizations.

* ext/opcache/zend_accelerator_hash: make prime_numbers const

* Zend/zend_signal: make zend_sigs const

* ext/dba: make dba_handler pointers const

* ext/exif: make php_tiff_bytes_per_format and other globals const

* ext/intl/grapheme: make grapheme_extract_iters const

* ext/mstring: make rare_codepoint_bitvec const

* ext/snmp: make objid_mib const

* ext/opcache: make all zend_shared_memory_handlers const
2023-01-23 13:46:58 +00: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
David CARLIER
e787d9a0dc GH-9370: Fix opcache jit protection bits.
Allow mprotect to occur, pthread_jit_write_np are just to allow mprotect
 flags to be used.

Closes #9371.
2022-08-24 16:11:35 +01:00
David CARLIER
1977ef92de opcache find best candidate near .text segment for large maps on FreeBSD.
Follow up on #8890 using similar workflow, we go through the php binary mapping per address boundaries.

Closes #8908.
2022-07-20 09:15:37 +01:00
Javier Eguiluz
14ced88c17
[ci skip] Fix typo (anough → enough)
Closes GH-8901.
2022-06-30 17:27:39 +02:00
Dmitry Stogov
17aa81a5e2
Allocate JIT bufer close to PHP .text segment to allow using direct IP-relative calls and jumps (#8890)
This implementation is based on https://github.com/php/php-src/pull/8618 developed by Su Tao, Wang Xue, Chen Hu and Lizhen Lizhen.
2022-06-30 10:49:24 +03:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
8a134c9a26 Merge branch 'PHP-8.0'
* PHP-8.0:
  Add supports for FreeBSD's PROT_MAX to let mprotect knows X flag can be applied in addition.
2021-03-05 16:44:25 +01:00
David Carlier
ae23852e41 Add supports for FreeBSD's PROT_MAX to let mprotect knows X flag can be applied in addition.
Closes GH-6738.
2021-03-05 16:44:08 +01:00
David CARLIER
559fc46b9f Fix ubsan warning on macos
Closes GH-6652.
2021-02-01 10:25:00 +01:00
David CARLIER
4414fd93d0 Distinguishing opcache SHM on stats tools for Mac
Closes GH-6628.
2021-01-26 10:51:33 +01:00
David Carlier
362194165a Fix opcache JIT on NetBSD with PaX
When PaX mprotect active, opcache JIT test fail as it needs
the PROT_MPROTECT macro to be able to allow further permission
promotion with mprotect.

Closes GH-5929.
2020-08-04 10:34:31 +02:00
Nikita Popov
ff8002fc7c Mark label as potentially unused 2019-06-12 16:47:48 +02:00
Dmitry Stogov
9a06876072 Added JIT compiler for x86 and x86_64 2019-04-01 10:27:11 +03:00
Dmitry Stogov
da919a8b65 Remove copyright years. 2019-02-05 10:33:28 +03:00
David Carlier
6a8260a0ac opcache/FreeBSD huge code page pragma support
Sort of following up on super pages support earlier, here
we also detect page mappings possibly eligible to go to
super pages.
2019-01-30 12:01:44 +01:00
Zeev Suraski
67e0138c0d Future-proof email addresses... 2018-11-01 18:30:28 +02:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Dmitry Stogov
12ce17c47e Use HUGE PAGES for opcahce SHM, if available. 2014-12-17 14:59:08 +03:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Dmitry Stogov
a62ffb72f4 Renamed Zend Optimizer+ into Zend OPcache 2013-03-19 10:32:24 +04:00
Dmitry Stogov
34d3202eda Merge Zend Optimizer+
git-subtree-dir: ext/opcache
git-subtree-mainline: b1dbfb7357
git-subtree-split: 8d35170c5f
2013-03-16 00:41:46 +04:00