which stack direction?

Larry McVoy (lm@bitmover.com)
Fri, 12 Mar 1999 11:45:36 -0800


I know of a new high end machine, under gentleman's NDA, which might be
running Linux some day. The compiler people for this machine want to
know if the Linux folks care which way the stack grows. The exact question
is:

"Does it matter to Linux whether the stacks in user codes run up
(pointer starts at a low address and increments to get more memory)
or down (pointer starts at a high address and decrements to get
more memory)? If it does matter, which is preferred?"

More details (some stuff removed to protect the guilty :-)

> : 1) Grow toward increasing addresses. Reason in favor: This significantly
> : reduces the probability that a user overrunning the bounds of a local
> : array will wipe out the traceback information that goes onto the
> : beginning of the routine's local stack segment. From experience, this
> : sort of problem is 10 to 20 times more likely on OS-A (where the stack
> : grows down) than OS-B (where the stack grows up).
> :
> : 2) Grow toward decreasing addresses. Reason in favor: OS-A does it this
> : way. OS-C also. Because of the way the stack memory segment is set up,
> : the usual argument about stack coming down and heap growing up in the
> : same address space is irrelevant on this system.

Thanks.

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