mmap: Add an exception to the stack gap for Hotspot JVM compatibility
authorBen Hutchings <ben@decadent.org.uk>
Thu, 30 Nov 2017 00:29:18 +0000 (00:29 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Tue, 20 Mar 2018 08:31:07 +0000 (08:31 +0000)
commita22be2cd8ec1e697749dc4c5e33d76200fa7e8db
treea106a7ee7a815e9f0cc8beb98deb7e945c20913b
parent0ce82905a4b60320d2c75b24eb3dded9029de4fe
mmap: Add an exception to the stack gap for Hotspot JVM compatibility

The Hotspot JVM can easily exhaust the default stack, and has a
SIGSEGV handler to cope with this by switching to a new stack segment.

However, on i386 it creates a single writable and executable page just
under the stack limit as a workaround for a bug in Exec Shield.  That
together with the enlarged stack gap causes the SIGSEGV handler to be
triggered when the stack pointer is further away from the stack limit,
and it doesn't recognise this as being a stack overflow.

This specifically affects programs that use JNI.  Hotspot doesn't
normally run Java code on the initial thread.

Reduce the effective stack guard gap on x86 if the previous vma is
a single page allocated as MAP_FIXED.

References: https://bugs.debian.org/865303
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name mmap-add-an-exception-to-the-stack-gap-for-hotspot-jvm.patch
mm/mmap.c