lkml.org 
[lkml]   [1999]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: which stack direction?
On Mon, 15 Mar 1999, Chris Wedgwood wrote:

> On Fri, Mar 12, 1999 at 11:45:36AM -0800, Larry McVoy wrote:
>
> > 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?"
>
> As someone else has pointed out, if the stack doesn't grow down, then
> it not so easy to make the stack and the heap grow towards each
> other.

This was me. More precisely, the stack usually grows towards heap+code.
Code likes to grow up, stack likes to have a known endpoint in memory..
This puts code at the bottom, stack at the top, and the heap at the top of
the code.

And I'll now amend that to say that it just doesn't matter on a 64 bit
system. Current 64-bit systems only have 40-some bits of real address
space. There is zero danger of running out of virtual address space. By
the time we're in danger of exhausting 64 bits of physical memory we will
have all long since moved to 128 bit systems. Put everything wherever you
want. Force all code addresses to have zero bytes to discourage stack
exploits. Have the stack grow up and give it a nice address prefix so it's
easy to read. Use one stack for addresses, another for variables. Give the
heap its own address prefix too. Whatever's easiest to read.

--
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.070 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site