]> git.pld-linux.org Git - packages/php.git/commitdiff
split x32 patch to be able to build without suhosin patch
authorElan Ruusamäe <glen@delfi.ee>
Tue, 9 Jun 2015 14:59:02 +0000 (17:59 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 9 Jun 2015 14:59:02 +0000 (17:59 +0300)
php.spec
x32-suhosin.patch [new file with mode: 0644]
x32.patch

index 5240bb7f86935ae6be007e3e33eba33172855600..c69e7287e31da8e77c38fd8260b73644413b93b1 100644 (file)
--- a/php.spec
+++ b/php.spec
@@ -217,6 +217,7 @@ Patch70:    mysql-lib-ver-mismatch.patch
 # git diff php-5.3.29..PHP-5.6 ./ext/fileinfo/Makefile.frag >> ~/rpm/packages/php/php-fileinfo.patch
 # git diff php-5.3.29..PHP-5.6 ./ext/fileinfo/data_file.c >> ~/rpm/packages/php/php-fileinfo.patch
 Patch71:       php-fileinfo.patch
 # git diff php-5.3.29..PHP-5.6 ./ext/fileinfo/Makefile.frag >> ~/rpm/packages/php/php-fileinfo.patch
 # git diff php-5.3.29..PHP-5.6 ./ext/fileinfo/data_file.c >> ~/rpm/packages/php/php-fileinfo.patch
 Patch71:       php-fileinfo.patch
+Patch72:       x32-suhosin.patch
 # Patch71-md5: 771e4934132c5f5c968248c954d1ef6e
 # Fixes for security bugs
 # https://repo.webtatic.com/yum/centos/5/SRPMS/repoview/php.html
 # Patch71-md5: 771e4934132c5f5c968248c954d1ef6e
 # Fixes for security bugs
 # https://repo.webtatic.com/yum/centos/5/SRPMS/repoview/php.html
@@ -2058,6 +2059,7 @@ cp -p php.ini-production php.ini
 %patch46 -p1
 %if %{with suhosin}
 %patch47 -p1
 %patch46 -p1
 %if %{with suhosin}
 %patch47 -p1
+%patch72 -p1
 %endif
 %patch68 -p1
 %patch48 -p1
 %endif
 %patch68 -p1
 %patch48 -p1
diff --git a/x32-suhosin.patch b/x32-suhosin.patch
new file mode 100644 (file)
index 0000000..db3619c
--- /dev/null
@@ -0,0 +1,50 @@
+--- 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;
index 469c7ca6f7ecd072cc9a4acd5ce9b280630d3596..5e4a89aa4d49e37af3cee93845d3963ec5cf371a 100644 (file)
--- a/x32.patch
+++ b/x32.patch
@@ -52,56 +52,6 @@ Fix bug #64729: compilation failure on x32
                 "rm"(size),
                 "rm"(offset));
  
                 "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;
---- 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)) {
 +#undef LP_SUFF
 +
          if (UNEXPECTED(overflow)) {
This page took 0.046516 seconds and 4 git commands to generate.