Skip to contentSkip to conversation

icedtea7-native: Fix memory leak when compiled with GCC 5.0+

PATCH Applied Erkka Kääriä 2 participants 2 messages Oct 23, 2015 – Oct 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 icedtea7-native: Fix memory leak when compiled with GCC 5.0+

Upstream-Status: Backport

Hotspot compiler has a bug where signed integers could overflow. This is undefined behaviour, and causes massive memory leak when compiled with GCC 5.0+, causing the build to fail.

This is fixed by backporting patch from
https://bugs.openjdk.java.net/browse/JDK-8078666 where it was fixed by Severin Gehwolf.

---
 .../icedtea-hotspot-fix-undefined-behaviour.patch  | 49 ++++++++++++++++++++++
 recipes-core/icedtea/openjdk-7-release-03b147.inc  |  2 +
 2 files changed, 51 insertions(+)
 create mode 100644 recipes-core/icedtea/openjdk-7-03b147/icedtea-hotspot-fix-undefined-behaviour.patch
recipes-core/icedtea/openjdk-7-03b147/icedtea-hotspot-fix-undefined-behaviour.patch new file +49 -0
new file mode 100644
index 0000000..56513a0
@@ -0,0 +1,49 @@
+Upstream-Status: Backport
+
+Hotspot compiler has a bug where signed integers could overflow. This is 
+undefined behaviour, and causes massive memory leak when compiled with GCC 5.0+, 
+causing the build to fail.
+
+This is fixed by backporting patch from 
+https://bugs.openjdk.java.net/browse/JDK-8078666 where it was fixed by 
+Severin Gehwolf.
+
+Signed-off-by: Erkka Kääriä <[email protected]>
+
+--- openjdk/hotspot/src/share/vm/opto/type.cpp
++++ openjdk/hotspot/src/share/vm/opto/type.cpp
+@@ -1077,11 +1077,11 @@ static int normalize_int_widen( jint lo, jint hi, int w ) {
+   // Certain normalizations keep us sane when comparing types.
+   // The 'SMALLINT' covers constants and also CC and its relatives.
+   if (lo <= hi) {
+-    if ((juint)(hi - lo) <= SMALLINT)  w = Type::WidenMin;
+-    if ((juint)(hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
++    if (((juint)hi - lo) <= SMALLINT)  w = Type::WidenMin;
++    if (((juint)hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
+   } else {
+-    if ((juint)(lo - hi) <= SMALLINT)  w = Type::WidenMin;
+-    if ((juint)(lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
++    if (((juint)lo - hi) <= SMALLINT)  w = Type::WidenMin;
++    if (((juint)lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT  
+   }
+   return w;
+ }
+@@ -1332,11 +1332,11 @@ static int normalize_long_widen( jlong lo, jlong hi, int w ) {
+   // Certain normalizations keep us sane when comparing types.
+   // The 'SMALLINT' covers constants.
+   if (lo <= hi) {
+-    if ((julong)(hi - lo) <= SMALLINT)   w = Type::WidenMin;
+-    if ((julong)(hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG
++    if (((julong)hi - lo) <= SMALLINT)   w = Type::WidenMin;
++    if (((julong)hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG  
+   } else {
+-    if ((julong)(lo - hi) <= SMALLINT)   w = Type::WidenMin;
+-    if ((julong)(lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
++    if (((julong)lo - hi) <= SMALLINT)   w = Type::WidenMin;
++    if (((julong)lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
+   }
+   return w;
+ }
+-- 
+2.1.4
+
recipes-core/icedtea/openjdk-7-release-03b147.inc +2 -0
index 98266f7..b1cf6e9 100644
@@ -84,6 +84,7 @@ OPENJDK_PATCHES = " \
 	file://icedtea-change-to-gdb-debug-format.patch;apply=no \
 	file://icedtea-disable-x11-in-headless.patch;apply=no \
 	file://icedtea-disable-sun.applet-for-tools-in-headless.patch;apply=no \
+	file://icedtea-hotspot-fix-undefined-behaviour.patch;apply=no \
         "
 
 OPENJDK_HEADLESS_PATCHES = " \
@@ -102,5 +103,6 @@ export DISTRIBUTION_PATCHES = " \
 	patches/icedtea-flags.patch \
 	patches/icedtea-openjdk-remove-currency-data-generation-expi.patch \
 	patches/icedtea-change-to-gdb-debug-format.patch \
+	patches/icedtea-hotspot-fix-undefined-behaviour.patch \
 	${CLEAN_X11_DISTRIBUTION_PATCH} \
         "
Signature · 12 lines
2.1.4

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw

Hi,

Quoted 9 lines · Erkka Kääriä

Hotspot compiler has a bug where signed integers could overflow. This is undefined behaviour, and causes massive memory leak when compiled with GCC 5.0+, causing the build to fail.

This is fixed by backporting patch from
https://bugs.openjdk.java.net/browse/JDK-8078666 where it was fixed by Severin Gehwolf.

Pushed to master, Thanks!

Quoted 70 lines

---

recipes-core/icedtea/openjdk-7-03b147/icedtea-hotspot-fix-undefined-behaviour.patch new file +49 -0
new file mode 100644
index 0000000..56513a0
@@ -0,0 +1,49 @@
+Upstream-Status: Backport
+
+Hotspot compiler has a bug where signed integers could overflow. This is 
+undefined behaviour, and causes massive memory leak when compiled with GCC 5.0+, 
+causing the build to fail.
+
+This is fixed by backporting patch from 
+https://bugs.openjdk.java.net/browse/JDK-8078666 where it was fixed by 
+Severin Gehwolf.
+
+Signed-off-by: Erkka Kääriä <[email protected]>
+
+--- openjdk/hotspot/src/share/vm/opto/type.cpp
++++ openjdk/hotspot/src/share/vm/opto/type.cpp
+@@ -1077,11 +1077,11 @@ static int normalize_int_widen( jint lo, jint hi, int w ) {
+   // Certain normalizations keep us sane when comparing types.
+   // The 'SMALLINT' covers constants and also CC and its relatives.
+   if (lo <= hi) {
+-    if ((juint)(hi - lo) <= SMALLINT)  w = Type::WidenMin;
+-    if ((juint)(hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
++    if (((juint)hi - lo) <= SMALLINT)  w = Type::WidenMin;
++    if (((juint)hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
+   } else {
+-    if ((juint)(lo - hi) <= SMALLINT)  w = Type::WidenMin;
+-    if ((juint)(lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
++    if (((juint)lo - hi) <= SMALLINT)  w = Type::WidenMin;
++    if (((juint)lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT  
+   }
+   return w;
+ }
+@@ -1332,11 +1332,11 @@ static int normalize_long_widen( jlong lo, jlong hi, int w ) {
+   // Certain normalizations keep us sane when comparing types.
+   // The 'SMALLINT' covers constants.
+   if (lo <= hi) {
+-    if ((julong)(hi - lo) <= SMALLINT)   w = Type::WidenMin;
+-    if ((julong)(hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG
++    if (((julong)hi - lo) <= SMALLINT)   w = Type::WidenMin;
++    if (((julong)hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG  
+   } else {
+-    if ((julong)(lo - hi) <= SMALLINT)   w = Type::WidenMin;
+-    if ((julong)(lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
++    if (((julong)lo - hi) <= SMALLINT)   w = Type::WidenMin;
++    if (((julong)lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
+   }
+   return w;
+ }
+-- 
+2.1.4
+
recipes-core/icedtea/openjdk-7-release-03b147.inc +1 -0
index 98266f7..b1cf6e9 100644
@@ -84,6 +84,7 @@ OPENJDK_PATCHES = " \
 	file://icedtea-change-to-gdb-debug-format.patch;apply=no \
 	file://icedtea-disable-x11-in-headless.patch;apply=no \
 	file://icedtea-disable-sun.applet-for-tools-in-headless.patch;apply=no \
+	file://icedtea-hotspot-fix-undefined-behaviour.patch;apply=no \
         "
 
 OPENJDK_HEADLESS_PATCHES = " \

recipes-core/icedtea/openjdk-7-release-03b147.inc export DISTRIBUTION_PATCHES = " \ · line 108

Quoted 6 lines
recipes-core/icedtea/openjdk-7-release-03b147.inc +1 -0
@@ -102,5 +103,6 @@ export DISTRIBUTION_PATCHES = " \
 	patches/icedtea-flags.patch \
 	patches/icedtea-openjdk-remove-currency-data-generation-expi.patch \
 	patches/icedtea-change-to-gdb-debug-format.patch \
+	patches/icedtea-hotspot-fix-undefined-behaviour.patch \
 	${CLEAN_X11_DISTRIBUTION_PATCH} \
 

Best Regards,
Maxin