Skip to contentSkip to conversation

cacao-initial-native: Fix undefined behaviour in gc

PATCH In review Erkka Kääriä 4 participants 4 messages Oct 21, 2015 – Oct 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cacao-initial-native: Fix undefined behaviour in gc

Upstream-Status: Backport

Fixes undefined behaviour in boehm GC used by cacao-initial-native as suggested at
https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb.

The undefined behaviour at very least causes a segmentation fault during classpath-native configure step with Fedora 22.

---
 recipes-core/cacao/cacao-initial-native_0.98.bb    |  1 +
 ...-0.9.8-initial-fix-gc-undefined-behaviour.patch | 35 ++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch
recipes-core/cacao/cacao-initial-native_0.98.bb +1 -0
index ec7fbdb..2a8ced5 100644
@@ -14,6 +14,7 @@ SRC_URI = "\
         http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PV}/cacao-${PV}.tar.bz2; \
         file://cacao-0.98-initial.patch \
         file://disable_hw_exceptions.patch \
+        file://cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch \
         "
 
 # libjvm disabled - it would conflict with cacao-native installations
recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch new file +35 -0
new file mode 100644
index 0000000..ccc35cb
@@ -0,0 +1,35 @@
+Upstream-Status: Backport
+
+This fixes undefined behaviour in boehm GC as suggested at
+https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb.
+
+The undefined behaviour at very least causes a segmentation fault during
+classpath-native configure step.
+    
+Signed-off-by: Erkka Kääriä <[email protected]>
+
+--- cacao-0.98/src/mm/boehm-gc/mark_rts.c
++++ cacao-0.98/src/mm/boehm-gc/mark_rts.c
+@@ -371,18 +371,7 @@ ptr_t p;
+ 
+ ptr_t GC_approx_sp()
+ {
+-    VOLATILE word dummy;
+-
+-    dummy = 42;	/* Force stack to grow if necessary.	Otherwise the	*/
+-    		/* later accesses might cause the kernel to think we're	*/
+-    		/* doing something wrong.				*/
+-#   ifdef _MSC_VER
+-#     pragma warning(disable:4172)
+-#   endif
+-    return((ptr_t)(&dummy));
+-#   ifdef _MSC_VER
+-#     pragma warning(default:4172)
+-#   endif
++    return __builtin_frame_address(0);
+ }
+ 
+ /*
+-- 
+2.1.4
+
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 Erkka,

Quoted 8 lines · Erkka Kääriä

Upstream-Status: Backport

Fixes undefined behaviour in boehm GC used by cacao-initial-native as suggested at
https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb.

The undefined behaviour at very least causes a segmentation fault during classpath-native configure step with Fedora 22.

Thanks for fixing it. Pushed to master.

Quoted 63 lines
---
 recipes-core/cacao/cacao-initial-native_0.98.bb    |  1 +
 ...-0.9.8-initial-fix-gc-undefined-behaviour.patch | 35 ++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch
recipes-core/cacao/cacao-initial-native_0.98.bb +1 -0
index ec7fbdb..2a8ced5 100644
@@ -14,6 +14,7 @@ SRC_URI = "\
         http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PV}/cacao-${PV}.tar.bz2; \
         file://cacao-0.98-initial.patch \
         file://disable_hw_exceptions.patch \
+        file://cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch \
         "
 
 # libjvm disabled - it would conflict with cacao-native installations
recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch new file +35 -0
new file mode 100644
index 0000000..ccc35cb
@@ -0,0 +1,35 @@
+Upstream-Status: Backport
+
+This fixes undefined behaviour in boehm GC as suggested at
+https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb.
+
+The undefined behaviour at very least causes a segmentation fault during
+classpath-native configure step.
+    
+Signed-off-by: Erkka Kääriä <[email protected]>
+
+--- cacao-0.98/src/mm/boehm-gc/mark_rts.c
++++ cacao-0.98/src/mm/boehm-gc/mark_rts.c
+@@ -371,18 +371,7 @@ ptr_t p;
+ 
+ ptr_t GC_approx_sp()
+ {
+-    VOLATILE word dummy;
+-
+-    dummy = 42;	/* Force stack to grow if necessary.	Otherwise the	*/
+-    		/* later accesses might cause the kernel to think we're	*/
+-    		/* doing something wrong.				*/
+-#   ifdef _MSC_VER
+-#     pragma warning(disable:4172)
+-#   endif
+-    return((ptr_t)(&dummy));
+-#   ifdef _MSC_VER
+-#     pragma warning(default:4172)
+-#   endif
++    return __builtin_frame_address(0);
+ }
+ 
+ /*
+-- 
+2.1.4
+
Signature · 1 line
2.1.4

Best Regards,
Maxin

#2 lore raw
Quoted 5 lines · Maxin B. John

Hi Erkka,

Quoted 2 lines · Erkka Kääriä

Upstream-Status: Backport

Quoted 8 lines
Quoted 6 lines

Fixes undefined behaviour in boehm GC used by cacao-initial-native as suggested at
https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb.

The undefined behaviour at very least causes a segmentation fault during classpath-native configure step with Fedora 22.

Thanks for fixing it. Pushed to master.

The Upstream-Status in the commit log was wrong; it belongs to the .patch file. Please follow the guidelines for the commit messages for this layer.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#3 lore raw
In reply to Erkka Kääriä
Quoted 6 lines · Erkka Kääriä

Upstream-Status: Backport

Fixes undefined behaviour in boehm GC used by cacao-initial-native as suggested at

https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb
.

Quoted 8 lines

The undefined behaviour at very least causes a segmentation fault during classpath-native configure step with Fedora 22.

---
 recipes-core/cacao/cacao-initial-native_0.98.bb    |  1 +
 ...-0.9.8-initial-fix-gc-undefined-behaviour.patch | 35

++++++++++++++++++++++

Quoted 2 lines
 2 files changed, 36 insertions(+)
 create mode 100644

recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/recipes-core/cacao/cacao-initial-native_0.98.bb

recipes-core/cacao/cacao-initial-native_0.98.bb SRC_URI = "\ · line 14

Quoted 5 lines

index ec7fbdb..2a8ced5 100644

recipes-core/cacao/cacao-initial-native_0.98.bb +0 -0
@@ -14,6 +14,7 @@ SRC_URI = "\
 

http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PV}/cacao-${PV}.tar.bz2;
\

Quoted 7 lines
recipes-core/cacao/cacao-initial-native_0.98.bb +1 -0
         file://cacao-0.98-initial.patch \
         file://disable_hw_exceptions.patch \
+        file://cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch \
         "
 
 # libjvm disabled - it would conflict with cacao-native installations

diff --git

a/recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch b/recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch

Quoted 4 lines

new file mode 100644
index 0000000..ccc35cb
--- /dev/null
+++

b/recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch

recipes-core/cacao/cacao-initial-native_0.98.bb line 4

Quoted 5 lines
recipes-core/cacao/cacao-initial-native_0.98.bb +4 -0
@@ -0,0 +1,35 @@
+Upstream-Status: Backport
+
+This fixes undefined behaviour in boehm GC as suggested at
+

https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb
.

Quoted 5 lines
recipes-core/cacao/cacao-initial-native_0.98.bb +5 -0
+
+The undefined behaviour at very least causes a segmentation fault during
+classpath-native configure step.
+
+Signed-off-by: Erkka Kääriä <[email protected]>

recipes-core/cacao/cacao-initial-native_0.98.bb line 19

Quoted 10 lines
recipes-core/cacao/cacao-initial-native_0.98.bb +10 -0
+
+--- cacao-0.98/src/mm/boehm-gc/mark_rts.c
++++ cacao-0.98/src/mm/boehm-gc/mark_rts.c
+@@ -371,18 +371,7 @@ ptr_t p;
+
+ ptr_t GC_approx_sp()
+ {
+-    VOLATILE word dummy;
+-
+-    dummy = 42;       /* Force stack to grow if necessary.    Otherwise

the */

Quoted 17 lines
recipes-core/cacao/cacao-initial-native_0.98.bb +16 -1
+-              /* later accesses might cause the kernel to think we're */
+-              /* doing something wrong.                               */
+-#   ifdef _MSC_VER
+-#     pragma warning(disable:4172)
+-#   endif
+-    return((ptr_t)(&dummy));
+-#   ifdef _MSC_VER
+-#     pragma warning(default:4172)
+-#   endif
++    return __builtin_frame_address(0);
+ }
+
+ /*
+--
+2.1.4
+
--
Quoted 2 lines

2.1.4

Nice, I've been trying to find this one for a while. I knew there was probably some UB somewhere, I just couldn't find it.

Quoted 15 lines

---------------------------------------------------------------------
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. --
_______________________________________________
Openembedded-devel mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel