--- old/src/java.base/share/native/libjli/java.c 2014-12-03 23:53:04.000000000 -0800 +++ new/src/java.base/share/native/libjli/java.c 2014-12-03 23:53:04.000000000 -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; + } } }