Commit Graph

392 Commits

Author SHA1 Message Date
Dmitry Stogov
89aa1b7392 Ensure proper data alignment 2015-08-31 13:56:42 +03:00
Dmitry Stogov
87f0f77105 Simplified integer overflow checks 2015-08-28 12:47:21 +03:00
Dmitry Stogov
5d15d2b26d Removed useless signal protection 2015-08-28 12:39:18 +03:00
Bob Weinand
76e3e99dd6 Fix issues with phpdbg SIGINT handler
Also fix valgrind warnings in allocator when not using mmap()ed memory
2015-08-21 23:36:31 +01:00
Dmitry Stogov
71af54e5f6 Mark error and exception functions as "cold" (Matt's idea) 2015-08-19 14:40:56 +03:00
Dmitry Stogov
162bf9e802 Reimplemented ability to get debug info (C source file and line number) in phpdbg without hacks and ABI breaks. 2015-08-11 16:33:47 +03:00
Dmitry Stogov
668ecaa606 Fixed bug #70098 (Real memory usage doesn't decrease) 2015-08-04 18:21:05 +03:00
Dmitry Stogov
225bb70498 Added missing API functions 2015-07-09 12:19:30 +03:00
Kalle Sommer Nielsen
ce2cd89258 Replace references to PHP_WIN32 and TSRM_WIN32 with ZEND_WIN32 in Zend/, this also fixes 1 instance of where fflush(stderr) was misplaced (zend_extensions.c) 2015-07-04 18:55:22 +02:00
Bob Weinand
70e86b8766 Also try __has_builtin() where builtins are used 2015-06-22 13:24:39 +02:00
Kalle Sommer Nielsen
de696d851f Fixed bug #69703 (Use __builtin_clzl on PowerPC) -- Patch by dja at axtens dot net
# Julien, even though 5.5 is still non security mode I don't think we should merge this patch but I leave the choice with you
2015-05-28 14:30:18 +02:00
Dmitry Stogov
fb8891d9fc Reset heap usage statistics on request shutdown 2015-05-18 23:06:23 +03:00
Dmitry Stogov
0604df8a82 Fixed phpdbg build 2015-05-14 16:47:22 +03:00
Dmitry Stogov
8e9b4b5aa7 Refactored custom storage API. 2015-05-14 14:56:13 +03:00
Stanislav Malyshev
5a1bef8eef Merge branch 'PHP-5.6'
* PHP-5.6:
  fix format
  update NEWS
  Add test for bug #69522
  Update tests
  Fix bug #69522 - do not allow int overflow
  Forgot test file
  Fix bug #69403 and other int overflows
  Fixed bug #69418 - more s->p fixes for filenames
  Fixed bug #69364 - use smart_str to assemble strings
  Fix bug #69453 - don't try to cut empty string
  Fix bug #69545 - avoid overflow when reading list

Conflicts:
	Zend/zend_alloc.c
	Zend/zend_operators.c
	ext/ftp/ftp.c
	ext/pcntl/pcntl.c
	ext/standard/basic_functions.c
	ext/standard/dir.c
	ext/standard/file.c
	ext/standard/pack.c
	ext/standard/string.c
	main/rfc1867.c
2015-05-12 15:00:24 -07:00
Stanislav Malyshev
c08f9c2c78 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  fix format
  update NEWS
  Add test for bug #69522
  Update tests
  Fix bug #69522 - do not allow int overflow
  Forgot test file
  Fix bug #69403 and other int overflows
  Fixed bug #69418 - more s->p fixes for filenames
  Fixed bug #69364 - use smart_str to assemble strings
  Fix bug #69453 - don't try to cut empty string
  Fix bug #69545 - avoid overflow when reading list

Conflicts:
	ext/pcntl/pcntl.c
	ext/standard/basic_functions.c
	ext/standard/pack.c
	ext/standard/tests/dir/opendir_variation1-win32.phpt
2015-05-12 14:24:15 -07:00
Stanislav Malyshev
c591f022f8 Fix bug #69403 and other int overflows 2015-05-10 02:20:08 -07:00
Dmitry Stogov
e38ed4c28f Changed zend_smart_str allocation granularity to do the better job together with Zend MM and avoid useless calls to erealloc().
The actual reallocation routiones are seprated from inlined code to reduce code size.
2015-04-16 14:45:08 +03:00
Dmitry Stogov
05232cc810 Revert "Changed zend_smart_str allocation granularity to do the better job together with Zend MM and avoid useless calls to erealloc()." That commit significantly increased the code size because of intensive inlining and more expensive reallocation code.
This reverts commit 5275e5560b.
2015-04-16 13:11:54 +03:00
Dmitry Stogov
5275e5560b Changed zend_smart_str allocation granularity to do the better job together with Zend MM and avoid useless calls to erealloc(). 2015-04-16 12:32:56 +03:00
Xinchen Hui
96f7a33df6 Temorary fix for phpdbg segfault while use zend_mm_set_custom_handlers 2015-03-09 11:19:05 +08:00
Xinchen Hui
4861e1bd6b Revert "Fixed memleak while using custom mm"
This reverts commit 5eabd979ff.
2015-03-09 00:41:19 +08:00
Xinchen Hui
5eabd979ff Fixed memleak while using custom mm 2015-03-09 00:18:54 +08:00
Xinchen Hui
51b96086d7 Revert "Fixed memleak in alloc_globals_ctor"
This reverts commit 85316b4bf0.
2015-03-09 00:17:52 +08:00
Dmitry Stogov
bb91bf83f9 Minimize copying of HashTable realocation 2015-03-05 17:22:10 +03:00
Reeze Xia
85316b4bf0 Fixed memleak in alloc_globals_ctor
This free operation is missed when new MM was introduced in master.
2015-02-28 13:14:39 +08:00
Anatol Belski
af3ca74501 made ZEND_TSRMLS_CACHE_* macros look like function calls
which also comply with the current semantics for such macros
2015-02-16 17:19:32 +01:00
Dmitry Stogov
eb8d7fe710 old_size is already known 2015-01-19 15:26:04 +03:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
73c1be2653 Bump year 2015-01-15 23:26:03 +08:00
Anatol Belski
d5b5ad72b6 cleanup 2015-01-14 12:32:23 +01:00
Anatol Belski
c0cb3a1dc4 depending on declaration the tsrm cache pointer might be unavailable
during shutdown when the main thread frees all the other threads
resources. Even otherwise, exact resource passed to the dtor should
be freed, not the one from the current thread.
2014-12-16 08:26:34 +01:00
Anatol Belski
e112f6a04e second shot on removing TSRMLS_* 2014-12-14 14:07:59 +01:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Anatol Belski
88bb9fedc4 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (111 commits)
  Fix zend_fcall_info_arg*() to use ZVAL_COPY
  Fixed #65213 - cannot cast SplFileInfo to boolean
  add initial install
  switch to C travis project instead of PHP
  use the generic TRAVIS environment var to check for travis (see http://docs.travis-ci.com/user/ci-environment/)
  fix TS build
  add config option to target codegen architectures
  updated NEWS
  updated NEWS
  Fixed bug #55541 errors spawn MessageBox, which blocks test automation
  Get rid of duplicate handlers (ZEND_ADD_SPEC_TMP_TMP and ZEND_ADD_SPEC_VAR_VAR are absolutely the same).
  Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*.
  Fixed __debugInfo() support
  Update UPGRADING for the new variadic functions, and re-sort.
  Improved POST INC/DEC
  make sure that we don't truncate the stack trace and cause false test failures when the test is executed in a directory with long path
  Missed closed folder mark
  Revert "Unecessary assignment"
  Fixed improper memory release
  Unecessary assignment
  ...
2014-12-05 03:50:02 +01:00
Dmitry Stogov
9e27a69c2f Fixed improper memory release 2014-12-02 16:29:13 +03:00
Dmitry Stogov
1982bce1a8 Support for different CPU page sizes 2014-12-02 16:17:26 +03:00
Anatol Belski
864cd82ace Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  updated NEWS
  refactored the mbstring config.w32
  Update NEWS
  Fixed compilation warnings
  Fixed bug #68504 --with-libmbfl configure option not present on Windows
  Changed "finally" handling. Removed EX(fast_ret) and EX(delayed_exception). Allocate and use additional IS_TMP_VAR slot on VM stack instead.
  the darwin specific test fails for me with the same output which is the expected for the original test I couldn't find anybody who managed to see this test passing, but I found a bunch of other reports on qa.php.net/reports and on google which do see this test failing on mac. if this change causes you to have this test failing on Mac, please drop me a mail so we can improve the current test so it passes for everybody.
  #68446 is fixed
  Reimplemented silence operator (@) handling on exceptions. Now each silence region is stored in op_array->brk_cont_array. On exception ZEND_HANDLE_EXCEPTION handler traverse this array and restore original EG(error_reporting) if exception occured inside a "silence" region.
  remove the NEWS entries for the reverted stuff
  typo fix
  go back with phpdbg to the state of 5.6.3, reverting the controversial commits(remote debugging/xml protocol)
  5.5.21 now
  New label length test
  Fix ext/filter/tests/033.phpt
  Fix filter_list test
  FILTER_VALIDATE_DOMAIN and RFC conformance for FILTER_VALIDATE_URL

Conflicts:
	ext/mbstring/config.w32
2014-11-27 15:59:43 +01:00
Dmitry Stogov
109baa0394 Fixed compilation warnings 2014-11-27 12:52:31 +03:00
Anatol Belski
4f3ac2cdbe Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (36 commits)
  NEWS
  adapt test for error message introduce in fix for #68463
  Fix bug #68463 listen.allowed_clients can silently result in no allowed access
  run a few request in this test
  fix test
  fix test
  added info about some other macro changes
  added note about toolset and phpize
  added note about the response files
  split msgfmt_format_intlcalendar_variant*.phpt for ICU 54.1
  split formatter_format*.phpt for ICP 54.1
  split dateformat_timezone_arg_variations*.phpt for ICU 54.1
  split dateformat_get_set_timezone_variant*.phpt for ICU 54.1
  fix icu version to test
  split ext/intl/tests/dateformat_get_set_calendar_variant*.phpt for 54.1
  split dateformat_formatObject_datetime_variant*.phpt for ICU 54.1
  split dateformat_formatObject_calendar_variant*.phpt for ICU 54.1
  split dateformat_create_cal_arg_variant2.phpt for ICU 53.1 and 54.1
  clone dateformat_calendars_variant3.phpt for ICU 54.1
  split collator_get_sort_key_variant3.phpt for icu 54.1
  ...
2014-11-20 15:20:18 +01:00
Veres Lajos
4b9535341a typo fixes - https://github.com/vlajos/misspell_fixer 2014-11-19 20:23:00 +00:00
Anatol Belski
c6bad96f30 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (398 commits)
  NEWS
  add test for bug #68381
  Fixed bug #68381 Set FPM log level earlier during init
  proper dllexport
  move to size_t where zend_string is used internally
  fix some datatype mismatches
  return after the warning, to fix uninitialized salt usage
  fix datatype mismatches
  add missing type specifier
  fix datatype mismatches
  fix unsigned check
  "extern" shouldn't be used for definitions
  joined identical conditional blocks
  simplify fpm tests
  SEND_VAR_NO_REF optimization
  Add test for bug #68442
  Add various tests for FPM - covering recent bugs (68420, 68421, 68423, 68428) - for UDS - for ping and status URI - for multi pool and multi mode
  Include small MIT FastCGI client library from https://github.com/adoy/PHP-FastCGI-Client
  Get rid of zend_free_op structure (use zval* instead). Get rid of useless TSRMLS arguments.
  Add new FPM test for IPv4/IPv6
  ...

Conflicts:
	win32/build/config.w32
2014-11-18 21:18:52 +01:00
Anatol Belski
1264731dd1 fix printf spec 2014-11-11 20:28:28 +01:00
Anatol Belski
c51a42076c Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (214 commits)
  fix datatype mismatch warnings
  fix datatype mismatches
  fix datatype mismatches
  fix datatype mismatches
  fix datatype mismatch warnings
  fix datatype mismatch warnings
  fix datatype mismatch warnings
  fix datatype mismatch warning
  fix datatype mismatches
  fix datatype mismatch warnings
  Re-add phpdbg to travis
  Added some NEWS
  Make xml valid (missing space between attrs)
  Fix info classes file name in xml
  Add note about <eval> tag for errors in xml.md
  Name the tag <eval> if the error id during ev cmd
  Do not print out xml as PHP print...
  Fix output to wrong function
  Fixed parameter order on %.*s
  Too much copypaste...
  ...
2014-10-24 22:28:32 +02:00
Anatol Belski
35576ea0ac fix datatype mismatch warnings 2014-10-24 20:50:05 +02:00
Anatol Belski
69fa6523e8 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  Fix allocator for 64bit zend_long with 32bit long
  Use intptr_t for zend_intptr_t typedef
  Fix format strings in zend_alloc
  Drop zend_long64 in favor of int64_t
  Removed deprecated fields
  NEWS
  cleanup NEWS
  removing the NEWS entry as we had to revert this fix for now
  Revert "Merge branch 'PHP-5.5' into PHP-5.6"
  Revert "fix TS build"
  Revert "Merge branch 'PHP-5.4' into PHP-5.5"
  Revert "Bug #67965: Fix blocking behavior in non-blocking crypto streams"
  Revert "Bug #41631: Fix regression from first attempt (6569db8)"
  NEWS
  Fixed Bug #65171 imagescale() fails
  Fixed bug #68234
  Fixed bug #68215 (Behavior of foreach has changed)
  Revert "Bug #41631: Observe socket read timeouts in SSL streams"
  PHP-5.6.3 is next
  update NEWS, 5.6.2 will be a security-only release
2014-10-16 13:49:35 +02:00
Nikita Popov
53a8584123 Fix allocator for 64bit zend_long with 32bit long 2014-10-16 12:42:23 +02:00
Nikita Popov
b65518faf3 Fix format strings in zend_alloc 2014-10-16 12:42:22 +02:00
Anatol Belski
c00424e427 bring back all the TSRMLS_FETCH() stuff
for better comparability with the mainstream
2014-10-15 09:37:55 +02:00
Anatol Belski
382f95e612 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (25 commits)
  Fix return code (merges are hard :( )
  fix bad merge
  Fix bug #68113 (Heap corruption in exif_thumbnail())
  Fix bug #68089 - do not accept options with embedded \0
  Fixed bug #68044: Integer overflow in unserialize() (32-bits only)
  Fix bug #68027 - fix date parsing in XMLRPC lib
  Fix bug #68113 (Heap corruption in exif_thumbnail())
  Fix bug #68089 - do not accept options with embedded \0
  Fixed bug #68044: Integer overflow in unserialize() (32-bits only)
  Fix bug #68027 - fix date parsing in XMLRPC lib
  Fix bug #68113 (Heap corruption in exif_thumbnail())
  Fix bug #68089 - do not accept options with embedded \0
  Fixed bug #68044: Integer overflow in unserialize() (32-bits only)
  Fix bug #68027 - fix date parsing in XMLRPC lib
  Fixed bug #68128
  Added API function to retrive current custom heap handlers
  update NEWS and UPGRADING
  Allow to substitute storage layer in memory manager.
  Upated NEWS
  Address issues raised by @nikic
  ...
2014-10-15 08:32:54 +02:00
Dmitry Stogov
d2daa19701 Added API function to retrive current custom heap handlers 2014-10-14 14:20:25 +04:00
Dmitry Stogov
2842766d7f Allow to substitute storage layer in memory manager. 2014-10-14 09:41:16 +04:00
Anatol Belski
bd9f17846d Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  bring back the correct php_version.h
  fix the empty_strings SAPI shutdown leak in TS build
  Use fastcall calling convention for heap functions
  fix leaking the empty_string in TS builds
  remove successive assignment
2014-10-06 18:36:26 +02:00
Dmitry Stogov
cc7c14cb76 Use fastcall calling convention for heap functions 2014-10-06 16:32:15 +04:00
Anatol Belski
76081df168 using pointer to the tsrm ls cache instead of a function call
yet another approach
2014-10-01 22:04:21 +02:00
Anatol Belski
9f9b3585b9 revert the local speedup approach 2014-10-01 01:33:01 +02:00
krakjoe
7d4f7c04b3 approach local pointers in performance sensitive areas 2014-09-27 17:11:56 +01:00
Anatol Belski
06d0230a0f cleanup TSRMLS_FETCH 2014-09-26 09:58:19 +02:00
Anatol Belski
d11734b4b0 reworked the patch, less new stuff but worky
TLS is already used in TSRM, the way exporting the tsrm cache through
a thread local variable is not portable. Additionally, the current
patch suffers from bugs which are hard to find, but prevent it to
be worky with apache. What is done here is mainly uses the idea
from the RFC patch, but

- __thread variable is removed
- offset math and declarations are removed
- extra macros and definitions are removed

What is done merely is

- use an inline function to access the tsrm cache. The function uses
  the portable tsrm_tls_get macro which is cheap
- all the TSRM_* macros are set to placebo. Thus this opens the way
  remove them later

Except that, the logic is old. TSRMLS_FETCH will have to be done once
per thread, then tsrm_get_ls_cache() can be used. Things seeming to be
worky are cli, cli server and apache. I also tried to enable bz2
shared and it has worked out of the box. The change is yet minimal
diffing to the current master bus is a worky start, IMHO. Though will
have to recheck the other previously done SAPIs - embed and cgi.

The offsets can be added to the tsrm_resource_type struct, then
it'll not be needed to declare them in the userspace. Even the
"done" member type can be changed to int16 or smaller, then adding
the offset as int16 will not change the struct size. As well on the
todo might be removing the hashed storage, thread_id != thread_id and
linked list logic in favour of the explicit TLS operations.
2014-09-25 18:48:27 +02:00
krakjoe
b3aebda9ea native tls initial patch 2014-09-20 20:22:14 +01:00
Anatol Belski
ea6da30396 make the return value more logic
as if clz() were returning 32 on empty size
2014-09-20 02:14:35 +02:00
Anatol Belski
7b4e8c64e0 make use of intrinsics available with VS for bitset lookups 2014-09-20 01:43:06 +02:00
Dmitry Stogov
e439349e58 Expose zend_safe_address() and use it in zend_arena_calloc() 2014-09-18 13:31:25 +04:00
Anatol Belski
3329d54cd9 better error messages in ZMM on Windows 2014-09-16 12:27:25 +02:00
Dmitry Stogov
13be4a5a4b emalloc() must not return NULL 2014-09-16 13:53:26 +04:00
Dmitry Stogov
be835b2d70 Fixed comments and removed useless code. 2014-09-08 11:08:05 +04:00
Nikita Popov
f4f9b54983 Revert "Move safe_address into zend_multiply.h"
This reverts commit 43b02e169c.

I'm getting symbol resolution issues for zend_error_noreturn in the
opcache.so, so reverting this for now.
2014-09-06 22:12:37 +02:00
Nikita Popov
43b02e169c Move safe_address into zend_multiply.h
This allows reuse in zend_arena_calloc.

Also renamed the function to zend_safe_address as it's no longer
private to the allocator.
2014-09-06 14:03:59 +02:00
Anatol Belski
6890830ec0 fix number format 2014-08-28 12:07:39 +02:00
Anatol Belski
cd8bbfa149 fixed bitset computing on win64 build 2014-08-26 20:43:33 +02:00
Dmitry Stogov
cb37fe1aae Fixed zero-size allocation in debug build 2014-08-26 21:32:20 +04:00
Anatol Belski
d285e346da temporary fix for win64 2014-08-26 16:27:14 +02:00
Dmitry Stogov
661f90d4d1 Replaced Zend Memory Manager 2014-08-26 16:21:58 +04:00
Anatol Belski
b63ab83256 several signature and data type fixes 2014-08-26 13:20:21 +02:00
Anatol Belski
4d997f63d9 master renames phase 3 2014-08-25 20:22:49 +02:00
Anatol Belski
6f9f0bf205 master renames phase 2 2014-08-25 19:28:33 +02:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski
5bb25776a0 further fixes on core 2014-08-16 15:34:04 +02:00
Anatol Belski
8ee2a4a9b5 first shot on merging the core fro the int64 branch 2014-08-16 11:16:11 +02:00
Xinchen Hui
6cc487df2c Revert "stash" (pushed by accident)
This reverts commit a18bf5fc93.
2014-07-18 16:27:31 +08:00
Xinchen Hui
a18bf5fc93 stash 2014-07-16 16:35:48 +08:00
Dmitry Stogov
5aa91be509 Simplify call-frame handling 2014-07-07 15:50:44 +04:00
Dmitry Stogov
0a77dcd4b9 Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something. 2014-07-03 01:02:25 +04:00
Dmitry Stogov
4b09dd69e6 Removed EG(active_op_array) and use corresponding value from EG(current_execute_data) 2014-07-02 22:03:21 +04:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
Xinchen Hui
0f53e37494 Merge branch 'PHP-5.6' 2014-01-03 11:09:07 +08:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
47c9027772 Bump year 2014-01-03 11:06:16 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
Dmitry Stogov
ef56cfb991 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed ZEND_MM_MEM_TYPE=mmap_zero
2013-12-26 11:53:03 +04:00
Dmitry Stogov
6414fe283e Fixed ZEND_MM_MEM_TYPE=mmap_zero 2013-12-26 11:51:32 +04:00
Kalle Sommer Nielsen
9e3551ba1f Eliminated the TSRMLS_FETCH() in zend_set_memory_limit() 2013-11-18 01:36:17 +01:00
Ard Biesheuvel
47e21a2c40 Fix assembly of safe_address() for aarch64 2013-07-04 10:25:38 +02:00
Nuno Lopes
c652cc93ec fix assembly of safe_address() for x86 and x86_64 2013-07-03 17:56:02 -04:00
Nuno Lopes
40cbceaf71 fix assembly of safe_address() for x86 and x86_64 2013-07-03 17:55:18 -04:00
Gustavo Lopes
865cc3a800 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix bug #64729: compilation failure on x32

Conflicts:
	Zend/zend_alloc.c
2013-04-30 19:36:08 +02:00
Gustavo Lopes
514afd67b6 Fix bug #64729: compilation failure on x32 2013-04-30 19:28:24 +02:00
Ard Biesheuvel
e2453276e9 Low-level ARM optimizations
- added ARM versions of zend_mm_high_bit()/zend_mm_low_bit()
- improved safe_address()
2013-02-11 14:36:58 +01:00
Ard Biesheuvel
aa12cdc361 Improve x86 inline assembler
- added cc annotation to inline asm that clobbers the condition
  flags
- remove hardcoded constants (IS_LONG,IS_DOUBLE)
- remove hardcoded offsets (zval->value, zval->type)
2013-02-11 13:53:27 +01:00
Xinchen Hui
a666285bc2 Happy New Year 2013-01-01 16:37:09 +08:00