Re: [PATCH] mm: larger stack guard gap, between vmas

From: Willy Tarreau
Date: Tue Jul 04 2017 - 11:52:25 EST


On Tue, Jul 04, 2017 at 12:36:11PM +0100, Ben Hutchings wrote:
> > If anywhing this would require to have a loop over all PROT_NONE
> > mappings to not hit into other weird usecases.
>
> That's what I was thinking of. Tried the following patch:
(...)
> - next = vma->vm_next;
> + /*
> + * Allow VM_NONE mappings in the gap as some applications try
> + * to make their own stack guards
> + */
> + for (next = vma->vm_next;
> + next && !(next->vm_flags & (VM_READ | VM_WRITE | VM_EXEC));
> + next = next->vm_next)
> + ;

That's what I wanted to propose but I feared someone would scream at me
for this loop :-)

+1 for me!

Willy