[packages/php/PHP_5_3] patch for x32 with suhosin enabled as well

glen glen at pld-linux.org
Fri Mar 20 15:49:07 CET 2015


commit ec621f6f7c0f2de93eb12f42ab6ad461675a8bc5
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Fri Mar 20 14:48:32 2015 +0000

    patch for x32 with suhosin enabled as well

 php.spec  |  2 +-
 x32.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)
---
diff --git a/php.spec b/php.spec
index 0edd0f9..4b5abe9 100644
--- a/php.spec
+++ b/php.spec
@@ -2052,10 +2052,10 @@ cp -p php.ini-production php.ini
 %patch44 -p1
 %patch45 -p1
 %patch46 -p1
-%patch68 -p1
 %if %{with suhosin}
 %patch47 -p1
 %endif
+%patch68 -p1
 %patch48 -p1
 %patch49 -p1
 %patch50 -p1
diff --git a/x32.patch b/x32.patch
index 5e4a89a..469c7ca 100644
--- a/x32.patch
+++ b/x32.patch
@@ -57,6 +57,56 @@ Fix bug #64729: compilation failure on x32
          if (UNEXPECTED(overflow)) {
                  zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
                  return 0;
+--- a/Zend/zend_alloc_canary.c
++++ b/Zend/zend_alloc_canary.c
+@@ -720,7 +720,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size)
+ #elif defined(__GNUC__) && defined(__x86_64__)
+ 	unsigned long n;
+ 
+-        __asm__("bsrq %1,%0\n\t" : "=r" (n) : "rm"  (_size));
++        __asm__("bsr %1,%0\n\t" : "=r" (n) : "rm"  (_size));
+         return (unsigned int)n;
+ #elif defined(_MSC_VER) && defined(_M_IX86)
+ 	__asm {
+@@ -746,12 +746,12 @@ static inline unsigned int zend_mm_low_bit(size_t _size)
+ #elif defined(__GNUC__) && defined(__x86_64__)
+         unsigned long n;
+ 
+-        __asm__("bsfq %1,%0\n\t" : "=r" (n) : "rm"  (_size));
++        __asm__("bsf %1,%0\n\t" : "=r" (n) : "rm"  (_size));
+         return (unsigned int)n;
+ #elif defined(_MSC_VER) && defined(_M_IX86)
+ 	__asm {
+ 		bsf eax, _size
+-   }
++	}
+ #else
+ 	static const int offset[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
+ 	unsigned int n;
+@@ -2481,12 +2481,22 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+         size_t res = nmemb;
+         unsigned long overflow = 0;
+ 
+-        __asm__ ("mulq %3\n\taddq %4,%0\n\tadcq %1,%1"
++#ifdef __ILP32__ /* x32 */
++# define LP_SUFF "l"
++#else /* amd64 */
++# define LP_SUFF "q"
++#endif
++
++        __asm__ ("mul" LP_SUFF  " %3\n\t"
++                 "add %4,%0\n\t"
++                 "adc %1,%1"
+              : "=&a"(res), "=&d" (overflow)
+              : "%0"(res),
+                "rm"(size),
+                "rm"(offset));
+ 
++#undef LP_SUFF
++
+         if (UNEXPECTED(overflow)) {
+                 zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
+                 return 0;
 --- php-5.3.29/Zend/zend_multiply.h~	2014-08-13 22:22:50.000000000 +0300
 +++ php-5.3.29/Zend/zend_multiply.h	2015-02-28 01:57:48.989051739 +0200
 @@ -19,7 +19,7 @@
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php.git/commitdiff/474fc0aa28e7c4886939447351932f435bddaecb



More information about the pld-cvs-commit mailing list