Re: [2/3] mm: fix up some user-visible effects of the stack guard page

From: Linus Torvalds
Date: Fri Aug 20 2010 - 12:50:46 EST


On Fri, Aug 20, 2010 at 9:35 AM, Ian Campbell <ijc@xxxxxxxxxxxxxx> wrote:
>
> On the other hand the VMA merging is just an optimisation, isn't it?

Well, yes and no. This would make it have semantic differences, if you
were to unmap the lower part of the stack.

I could imagine some crazy program wanting to basically return the
stack pages to the system after doing heavy recursion. IOW, they could
do

- use lots of stack because we're recursing 1000 levels deep

- know that we used lots of stack, so after returning do something like

stack = &local variable;
align stack down by two pages
munmap down from there to give memory back

and now it really would be a semantic change where the VM_GROWSDOWN
bit has literally disappeared.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/