From 365913a04302f6fb65bc6ebe02058573c1d81f3e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 2 Dec 2015 10:15:06 +0100 Subject: add upstream patch for i386 --- php-pecl-pthreads-php7.spec | 13 +++-- pthreads-upstream.patch | 137 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 pthreads-upstream.patch diff --git a/php-pecl-pthreads-php7.spec b/php-pecl-pthreads-php7.spec index f10a0ea..f527085 100644 --- a/php-pecl-pthreads-php7.spec +++ b/php-pecl-pthreads-php7.spec @@ -17,12 +17,14 @@ Summary: Threading API Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 3.1.4 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: %{pecl_name}-upstream.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{?scl_prefix}php-zts-devel > 7 BuildRequires: %{?scl_prefix}php-pear @@ -74,6 +76,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO sed -e 's/role="test"/role="src"/' -i package.xml cd %{pecl_name}-%{version} +%patch0 -p1 -b .upstream # Sanity check, really often broken extver=$(sed -n '/#define PHP_PTHREADS_VERSION/{s/.* "//;s/".*$//;p}' php_pthreads.h) @@ -139,10 +142,6 @@ fi %check cd %{pecl_name}-%{version} -%ifnarch x86_64 -# https://github.com/krakjoe/pthreads/issues/523 -rm tests/return-types.phpt -%endif : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ @@ -172,6 +171,10 @@ rm -rf %{buildroot} %changelog +* Wed Dec 2 2015 Remi Collet - 3.1.4-2 +- add upstream patch to fix segfault on i386 + https://github.com/krakjoe/pthreads/issues/523 + * Wed Dec 2 2015 Remi Collet - 3.1.4-1 - Update to 3.1.4 (stable) diff --git a/pthreads-upstream.patch b/pthreads-upstream.patch new file mode 100644 index 0000000..74826fb --- /dev/null +++ b/pthreads-upstream.patch @@ -0,0 +1,137 @@ +From 703e8968a30b11fa87161f69058b13bdfc3eebbb Mon Sep 17 00:00:00 2001 +From: Joe Watkins +Date: Wed, 2 Dec 2015 08:21:32 +0000 +Subject: [PATCH] fix #523 + +--- + php_pthreads.c | 22 ++++++++++++++++++---- + 1 file changed, 18 insertions(+), 4 deletions(-) + +diff --git a/php_pthreads.c b/php_pthreads.c +index 0f11eeb..e39fe4c 100644 +--- a/php_pthreads.c ++++ b/php_pthreads.c +@@ -192,15 +192,22 @@ static inline zend_bool pthreads_verify_type(zend_execute_data *execute_data, zv + static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) { + if (Z_TYPE(PTHREADS_ZG(this)) != IS_UNDEF) { + zend_execute_data *execute_data = EG(current_execute_data); +- uint32_t arg_num = EX(opline)->op1.num; ++ uint32_t arg_num = EX(opline)->op1.num; ++ zval *var = NULL; + + if (UNEXPECTED(arg_num > EX_NUM_ARGS())) { + return ZEND_USER_OPCODE_DISPATCH; + } + ++#if ZEND_USE_ABS_CONST_ADDR ++ var = EX(opline)->result.var; ++#else ++ var = EX_VAR(EX(opline)->result.num); ++#endif ++ + if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) { + if (pthreads_verify_type(execute_data, +- EX_VAR(EX(opline)->result.var), ++ var, + &EX(func)->common.arg_info[arg_num-1])) { + EX(opline)++; + return ZEND_USER_OPCODE_CONTINUE; +@@ -214,13 +221,20 @@ static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) { + static inline int php_pthreads_verify_return_type(ZEND_OPCODE_HANDLER_ARGS) { + if (Z_TYPE(PTHREADS_ZG(this)) != IS_UNDEF) { + zend_execute_data *execute_data = EG(current_execute_data); +- ++ zval *var = NULL; ++ + if (EX(opline)->op1_type == IS_UNUSED) { + return ZEND_USER_OPCODE_DISPATCH; + } + ++#if ZEND_USE_ABS_CONST_ADDR ++ var = EX(opline)->op1.var; ++#else ++ var = EX_VAR(EX(opline)->op1.num); ++#endif ++ + if (pthreads_verify_type(execute_data, +- EX_VAR(EX(opline)->op1.num), ++ var, + EX(func)->common.arg_info - 1)) { + EX(opline)++; + return ZEND_USER_OPCODE_CONTINUE; +From 7a86467968143eb3bf04eec1b9f1987f586cd0c3 Mon Sep 17 00:00:00 2001 +From: Joe Watkins +Date: Wed, 2 Dec 2015 08:27:12 +0000 +Subject: [PATCH] fix for #523 was obviously wrong ... mornings ... + +--- + php_pthreads.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/php_pthreads.c b/php_pthreads.c +index e39fe4c..4c984ae 100644 +--- a/php_pthreads.c ++++ b/php_pthreads.c +@@ -200,7 +200,9 @@ static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) { + } + + #if ZEND_USE_ABS_CONST_ADDR +- var = EX(opline)->result.var; ++ if (EX(opline)->result_type == IS_CONST) { ++ var = EX(opline)->result.var; ++ } else var = EX_VAR(EX(opline)->result.num); + #else + var = EX_VAR(EX(opline)->result.num); + #endif +@@ -228,7 +230,9 @@ static inline int php_pthreads_verify_return_type(ZEND_OPCODE_HANDLER_ARGS) { + } + + #if ZEND_USE_ABS_CONST_ADDR +- var = EX(opline)->op1.var; ++ if (EX(opline)->op1_type == IS_CONST) { ++ var = EX(opline)->op1.var; ++ } else EX_VAR(EX(opline)->op1.num); + #else + var = EX_VAR(EX(opline)->op1.num); + #endif +From c4fe122188c6ecb4b71060fb191d4b1258691af0 Mon Sep 17 00:00:00 2001 +From: Joe Watkins +Date: Wed, 2 Dec 2015 09:03:40 +0000 +Subject: [PATCH] I miss the good old days, when things were simple ... #523 + +--- + php_pthreads.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/php_pthreads.c b/php_pthreads.c +index 4c984ae..e24d5e8 100644 +--- a/php_pthreads.c ++++ b/php_pthreads.c +@@ -201,7 +201,7 @@ static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) { + + #if ZEND_USE_ABS_CONST_ADDR + if (EX(opline)->result_type == IS_CONST) { +- var = EX(opline)->result.var; ++ var = (zval*) EX(opline)->result.var; + } else var = EX_VAR(EX(opline)->result.num); + #else + var = EX_VAR(EX(opline)->result.num); +@@ -225,14 +225,14 @@ static inline int php_pthreads_verify_return_type(ZEND_OPCODE_HANDLER_ARGS) { + zend_execute_data *execute_data = EG(current_execute_data); + zval *var = NULL; + +- if (EX(opline)->op1_type == IS_UNUSED) { ++ if (EX(opline)->op1_type == IS_UNUSED) { + return ZEND_USER_OPCODE_DISPATCH; + } + + #if ZEND_USE_ABS_CONST_ADDR +- if (EX(opline)->op1_type == IS_CONST) { +- var = EX(opline)->op1.var; +- } else EX_VAR(EX(opline)->op1.num); ++ if (EX(opline)->op1_type & IS_CONST) { ++ var = (zval*) EX(opline)->op1.var; ++ } else var = EX_VAR(EX(opline)->op1.num); + #else + var = EX_VAR(EX(opline)->op1.num); + #endif -- cgit