Re: [PATCH] mm: larger stack guard gap, between vmas
From: Willy Tarreau
Date: Tue Jul 04 2017 - 15:04:01 EST
On Tue, Jul 04, 2017 at 11:47:37AM -0700, Linus Torvalds wrote:
> say that you are using lots of threads, so that you know your stack
> space is limited. What you do is to use MAP_FIXED a lot, and you lay
> out your stacks fairly densely (with each other, but also possibly
> with other mappings), with that PROT_NONE redzoning mapping in between
> the "dense" allocations.
> So when the kernel wants to grow the stack, it finds the PROT_NONE
> redzone mapping - but there's possibly other maps right under it, so
> the stack_guard_gap still hits other mappings.
OK I didn't get that use case, that totally makes sense indeed! So
now we use PROT_NONE not as something that must be skipped to find
the unmapped area but as a hint that the application apparently
wants the stack to stop here.
Thanks for this clear explanation!