diff options
Diffstat (limited to 'recipes-core/openjdk/patches-openjdk-8/1001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch')
-rw-r--r-- | recipes-core/openjdk/patches-openjdk-8/1001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/recipes-core/openjdk/patches-openjdk-8/1001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch b/recipes-core/openjdk/patches-openjdk-8/1001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch new file mode 100644 index 0000000..280ee60 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/1001-hotspot-fix-crash-on-JNI_CreateJavaVM.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From 5e8080a8dd56205f550f7c490f864c95dc8e509b Mon Sep 17 00:00:00 2001 | ||
2 | From: Wenlin Kang <wenlin.kang@windriver.com> | ||
3 | Date: Sun, 17 Feb 2019 22:38:33 -0800 | ||
4 | Subject: [PATCH 1001/1012] hotspot: fix crash on JNI_CreateJavaVM | ||
5 | |||
6 | In function os::pd_create_stack_guard_pages(char* addr, size_t size), | ||
7 | when addr < os::Linux::initial_thread_stack_bottom(), usually munmap() | ||
8 | will not be called, but when mincore()==-1, get_stack_commited_bottom() | ||
9 | will make stack_extent < os::Linux::initial_thread_stack_bottom() and | ||
10 | stack_extent < addr too, then munmap() is called, in such case, it may | ||
11 | cause segment(we have reproduced it on linux_PPC). | ||
12 | |||
13 | Upstream-Status: Pending | ||
14 | |||
15 | Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> | ||
16 | Signed-off-by: Richard Leitner <richard.leitner@skidata.com> | ||
17 | --- | ||
18 | src/os/linux/vm/os_linux.cpp | 3 ++- | ||
19 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp | ||
22 | index 03cabfefb..4f28cc1fb 100644 | ||
23 | --- a/hotspot/src/os/linux/vm/os_linux.cpp | ||
24 | +++ b/hotspot/src/os/linux/vm/os_linux.cpp | ||
25 | @@ -3192,7 +3192,8 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) { | ||
26 | uintptr_t stack_extent = (uintptr_t) os::Linux::initial_thread_stack_bottom(); | ||
27 | unsigned char vec[1]; | ||
28 | |||
29 | - if (mincore((address)stack_extent, os::vm_page_size(), vec) == -1) { | ||
30 | + if ((mincore((address)stack_extent, os::vm_page_size(), vec) == -1) | ||
31 | + && ((size_t)addr > (size_t)stack_extent)) { | ||
32 | // Fallback to slow path on all errors, including EAGAIN | ||
33 | stack_extent = (uintptr_t) get_stack_commited_bottom( | ||
34 | os::Linux::initial_thread_stack_bottom(), | ||
35 | -- | ||
36 | 2.24.1 | ||
37 | |||