--- a/jdk/src/java.base/share/native/libjli/java.c Wed Dec 03 16:44:35 2014 +0100
+++ b/jdk/src/java.base/share/native/libjli/java.c Thu Dec 04 11:26:46 2014 -0800
@@ -169,6 +169,13 @@
static jlong initialHeapSize = 0; /* inital heap size */
/*
+ * A minimum -Xss stack size suitable for all platforms.
+ */
+#ifndef STACK_SIZE_MINIMUM
+#define STACK_SIZE_MINIMUM (32 * KB)
+#endif
+
+/*
* Entry point.
*/
int
@@ -773,6 +780,14 @@
jlong tmp;
if (parse_size(str + 4, &tmp)) {
threadStackSize = tmp;
+ /*
+ * Make sure the thread stack size is big enough that we won't get a stack
+ * overflow before the JVM startup code can check to make sure the stack
+ * is big enough.
+ */
+ if (threadStackSize < STACK_SIZE_MINIMUM) {
+ threadStackSize = STACK_SIZE_MINIMUM;
+ }
}
}