Skip to contentSkip to conversation

icedtea7-native: Fix segmentation fault

PATCH In review Ricardo Ribalda Delgado 1 participant 4 messages Oct 31, 2016 – Nov 16, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 icedtea7-native: Fix segmentation fault

Without this patch the generated icedtea produces segmentation faults. This is probably due to a race condition during cleanout.

---
 recipes-core/icedtea/icedtea7-native.inc           |  2 ++
 .../icedtea/openjdk-7-03b147/sigsegv.patch         | 42 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 recipes-core/icedtea/openjdk-7-03b147/sigsegv.patch
recipes-core/icedtea/icedtea7-native.inc +2 -0
index 00756888b62c..0ecf620cd279 100644
@@ -42,6 +42,7 @@ SRC_URI = " \
   file://allow-headless-build.patch;striplevel=0 \
   file://jaxws_fix_NullPointerException.patch;apply=no \
   file://timezoneszip.patch \
+  file://sigsegv.patch;apply=no \
   "
 
 S = "${WORKDIR}/${ICEDTEA}"
@@ -153,6 +154,7 @@ do_configure_append() {
 	oe_runmake patch-boot
 
 	patch -p1 < ${WORKDIR}/jaxws_fix_NullPointerException.patch
+	patch -p1 < ${WORKDIR}/sigsegv.patch
 }
 
 EXTRA_OEMAKE = ' \
recipes-core/icedtea/openjdk-7-03b147/sigsegv.patch new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.10.1
#1 lore raw

PATCH 2/2 openjdk-7-release-03b147.inc: Ignore deprecation

readdir_r has been deprecated since glibc 2.24. As openjdk uses this function, a warning is generated during build that gets turned into an error when -Werror is used.

While the readdir function is suggested as an replacement, it has slightly different API. The warning is ignored instead to prevent any unexpected breakage from patching the offending functions.

(Note: This is just a port of 0f127a49696 from Erkka Kääriä for openjdk-7 , all the credit for him)

Credit-to: Erkka Kääriä <[email protected]>

---
 recipes-core/icedtea/openjdk-7-release-03b147.inc | 4 ++++
 1 file changed, 4 insertions(+)
recipes-core/icedtea/openjdk-7-release-03b147.inc +4 -0
index 068572959fa1..1d054ffe35e8 100644
@@ -7,6 +7,10 @@ FILESPATH =. "${FILE_DIRNAME}/openjdk-7-03b147:"
 # Force arm mode for now
 ARM_INSTRUCTION_SET_armv4t = "ARM"
 
+# readdir_r was deprecated in glibc-2.24. Ignore the error for now
+# NOTE: When updating the recipe, please check if this is still needed
+CFLAGS_append = " -Wno-error=deprecated-declarations"
+
 ICEDTEA_URI = "http://icedtea.wildebeest.org/download/source/${ICEDTEA}.tar.gz;name=iced"
 
 ICEDTEA_PREFIX = "icedtea7-forest-2.1"
Signature · 1 line
2.10.1
#2 lore raw

Re: [meta-java][PATCH 2/2] openjdk-7-release-03b147.inc: Ignore deprecation

ping?

Quoted 35 lines · Ricardo Ribalda Delgado

readdir_r has been deprecated since glibc 2.24. As openjdk uses this function, a warning is generated during build that gets turned into an error when -Werror is used.

While the readdir function is suggested as an replacement, it has slightly different API. The warning is ignored instead to prevent any unexpected breakage from patching the offending functions.

(Note: This is just a port of 0f127a49696 from Erkka Kääriä for openjdk-7 , all the credit for him)

Credit-to: Erkka Kääriä <[email protected]>

---
 recipes-core/icedtea/openjdk-7-release-03b147.inc | 4 ++++
 1 file changed, 4 insertions(+)
recipes-core/icedtea/openjdk-7-release-03b147.inc +4 -1
index 068572959fa1..1d054ffe35e8 100644
@@ -7,6 +7,10 @@ FILESPATH =. "${FILE_DIRNAME}/openjdk-7-03b147:"
 # Force arm mode for now
 ARM_INSTRUCTION_SET_armv4t = "ARM"
 
+# readdir_r was deprecated in glibc-2.24. Ignore the error for now
+# NOTE: When updating the recipe, please check if this is still needed
+CFLAGS_append = " -Wno-error=deprecated-declarations"
+
 ICEDTEA_URI = "http://icedtea.wildebeest.org/download/source/${ICEDTEA}.tar.gz;name=iced"
 
 ICEDTEA_PREFIX = "icedtea7-forest-2.1"
--

2.10.1

Signature · 1 line
Ricardo Ribalda
#3 lore raw
In reply to Ricardo Ribalda Delgado

ping?

Quoted 81 lines · Ricardo Ribalda Delgado

Without this patch the generated icedtea produces segmentation faults. This is probably due to a race condition during cleanout.

---
 recipes-core/icedtea/icedtea7-native.inc           |  2 ++
 .../icedtea/openjdk-7-03b147/sigsegv.patch         | 42 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 recipes-core/icedtea/openjdk-7-03b147/sigsegv.patch
recipes-core/icedtea/icedtea7-native.inc +2 -0
index 00756888b62c..0ecf620cd279 100644
@@ -42,6 +42,7 @@ SRC_URI = " \
   file://allow-headless-build.patch;striplevel=0 \
   file://jaxws_fix_NullPointerException.patch;apply=no \
   file://timezoneszip.patch \
+  file://sigsegv.patch;apply=no \
   "
 
 S = "${WORKDIR}/${ICEDTEA}"
@@ -153,6 +154,7 @@ do_configure_append() {
        oe_runmake patch-boot
 
        patch -p1 < ${WORKDIR}/jaxws_fix_NullPointerException.patch
+       patch -p1 < ${WORKDIR}/sigsegv.patch
 }
 
 EXTRA_OEMAKE = ' \
recipes-core/icedtea/openjdk-7-03b147/sigsegv.patch new file +42 -1
new file mode 100644
index 000000000000..0c3e44eff826
@@ -0,0 +1,42 @@
+diff --git a/openjdk-boot/hotspot/src/share/vm/runtime/thread.cpp b/openjdk-boot/hotspot/src/share/vm/runtime/thread.cpp
+index 8b7059c8389f..67e9e7bd4bce 100644
+--- a/openjdk-boot/hotspot/src/share/vm/runtime/thread.cpp
++++ b/openjdk-boot/hotspot/src/share/vm/runtime/thread.cpp
+@@ -764,10 +764,13 @@ bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
+ }
+
+ void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
+-  active_handles()->oops_do(f);
++  if (f && active_handles())
++        active_handles()->oops_do(f);
+   // Do oop for ThreadShadow
+-  f->do_oop((oop*)&_pending_exception);
+-  handle_area()->oops_do(f);
++  if (f)
++        f->do_oop((oop*)&_pending_exception);
++  if (f && handle_area())
++        handle_area()->oops_do(f);
+ }
+
+ void Thread::nmethods_do(CodeBlobClosure* cf) {
+diff --git a/openjdk/hotspot/src/share/vm/runtime/thread.cpp b/openjdk/hotspot/src/share/vm/runtime/thread.cpp
+index 8b7059c8389f..67e9e7bd4bce 100644
+--- a/openjdk/hotspot/src/share/vm/runtime/thread.cpp
++++ b/openjdk/hotspot/src/share/vm/runtime/thread.cpp
+@@ -764,10 +764,13 @@ bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
+ }
+
+ void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
+-  active_handles()->oops_do(f);
++  if (f && active_handles())
++        active_handles()->oops_do(f);
+   // Do oop for ThreadShadow
+-  f->do_oop((oop*)&_pending_exception);
+-  handle_area()->oops_do(f);
++  if (f)
++        f->do_oop((oop*)&_pending_exception);
++  if (f && handle_area())
++        handle_area()->oops_do(f);
+ }
+
+ void Thread::nmethods_do(CodeBlobClosure* cf) {
--

2.10.1

Signature · 1 line
Ricardo Ribalda