summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenlin Kang <wenlin.kang@windriver.com>2019-02-18 18:30:57 -0800
committerRichard Leitner <richard.leitner@skidata.com>2019-12-27 12:09:02 +0100
commit481f8bc2bd1662d6bc52e5c8af79c37b7d266b53 (patch)
treefd913987366197719c6896110bcf6299a6896c85
parent7a3a8322a747c8803dbfbf3aa4912cf9f8158695 (diff)
downloadmeta-java-481f8bc2bd1662d6bc52e5c8af79c37b7d266b53.tar.gz
openjdk-8: fix a random crash on JNI_CreateJavaVM
When call JNI_CreateJavaVM API, sometimes it will crash(we have reproduced it on quemuppc), this patch fixes it. Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
-rw-r--r--recipes-core/openjdk/openjdk-8-release-172b11-common.inc1
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch36
2 files changed, 37 insertions, 0 deletions
diff --git a/recipes-core/openjdk/openjdk-8-release-172b11-common.inc b/recipes-core/openjdk/openjdk-8-release-172b11-common.inc
index d4e80f6..f50b494 100644
--- a/recipes-core/openjdk/openjdk-8-release-172b11-common.inc
+++ b/recipes-core/openjdk/openjdk-8-release-172b11-common.inc
@@ -21,6 +21,7 @@ PATCHES_URI = "\
21 ${LIBPNG_NEON_PATCH} \ 21 ${LIBPNG_NEON_PATCH} \
22 file://handle_extra_output.patch \ 22 file://handle_extra_output.patch \
23 file://hotspot-handle-gcc7-format-overflow.patch \ 23 file://hotspot-handle-gcc7-format-overflow.patch \
24 file://0001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch \
24" 25"
25HOTSPOT_UB_PATCH = "\ 26HOTSPOT_UB_PATCH = "\
26 file://0014-hotspot-zero-fix-undefined-behaviour-gcc-v8-fix.patch \ 27 file://0014-hotspot-zero-fix-undefined-behaviour-gcc-v8-fix.patch \
diff --git a/recipes-core/openjdk/patches-openjdk-8/0001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch b/recipes-core/openjdk/patches-openjdk-8/0001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch
new file mode 100644
index 0000000..4618b6b
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch
@@ -0,0 +1,36 @@
1From d0ebd6f108df9b0f9533de6f16280ceec136d8e6 Mon Sep 17 00:00:00 2001
2From: Wenlin Kang <wenlin.kang@windriver.com>
3Date: Sun, 17 Feb 2019 22:38:33 -0800
4Subject: [PATCH] hotspot: fix crash on JNI_CreateJavaVM
5
6In function os::pd_create_stack_guard_pages(char* addr, size_t size),
7when addr < os::Linux::initial_thread_stack_bottom(), usually munmap()
8will not be called, but when mincore()==-1, get_stack_commited_bottom()
9will make stack_extent < os::Linux::initial_thread_stack_bottom() and
10stack_extent < addr too, then munmap() is called, in such case, it may
11cause segment(we have reproduced it on linux_PPC).
12
13Upstream-Status: Pending
14
15Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
16---
17 hotspot/src/os/linux/vm/os_linux.cpp | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
21index 044a70a6..b8246ce4 100644
22--- a/hotspot/src/os/linux/vm/os_linux.cpp
23+++ b/hotspot/src/os/linux/vm/os_linux.cpp
24@@ -3078,7 +3078,8 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
25 uintptr_t stack_extent = (uintptr_t) os::Linux::initial_thread_stack_bottom();
26 unsigned char vec[1];
27
28- if (mincore((address)stack_extent, os::vm_page_size(), vec) == -1) {
29+ if ((mincore((address)stack_extent, os::vm_page_size(), vec) == -1)
30+ && ((size_t)addr > (size_t)stack_extent)) {
31 // Fallback to slow path on all errors, including EAGAIN
32 stack_extent = (uintptr_t) get_stack_commited_bottom(
33 os::Linux::initial_thread_stack_bottom(),
34--
352.17.1
36