]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[IA64] bugfix stack layout upside-down
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Fri, 23 Mar 2007 03:17:46 +0000 (12:17 +0900)
committerTony Luck <tony.luck@intel.com>
Thu, 29 Mar 2007 22:15:24 +0000 (15:15 -0700)
ia64 expects following vm layout:

== low memory
[register-stack grows up]
[memory-stack grows down]
== high memory

But the code assigns the base of the register stack at the
maximum stack size offset from the fixed address where the
stack *might* start.  Stack randomization will result in the
memory stack starting at a lower address than this, and if the
user has set a low stack limit with "ulimit -s", then you can
end up with the register stack above the memory stack (or if
you were very unlucky right on top of it!).

Fix: Calculate the base address for the register stack starting
from the actual address of the memory stack.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/mm/init.c

index c8da621aab17b9f94a71e1305892471cbef1577c..4f36987eea7241bfea99187f0ec5765202426bd1 100644 (file)
@@ -155,7 +155,7 @@ ia64_set_rbs_bot (void)
 
        if (stack_size > MAX_USER_STACK_SIZE)
                stack_size = MAX_USER_STACK_SIZE;
-       current->thread.rbs_bot = STACK_TOP - stack_size;
+       current->thread.rbs_bot = PAGE_ALIGN(current->mm->start_stack - stack_size);
 }
 
 /*