开发者

Growing or descending stack

开发者 https://www.devze.com 2023-02-07 09:53 出处:网络
In the context of operating systems and processes, which design is better - A growing or descending stack [User mode/kern开发者_C百科el mode stack] ?It depends upon placement of the heap and library m

In the context of operating systems and processes, which design is better - A growing or descending stack [User mode/kern开发者_C百科el mode stack] ?


It depends upon placement of the heap and library mappings; if the libraries and heap are low, then growing the stack downwards makes a lot of sense. If the libraries and heap are high, then growing the stack upwards makes a lot of sense. And both seem pretty arbitrary to me.


From a security point of view, I prefer the stack growing upwards, as it reduces the probability of a buffer overflow attack succeeding; there are several architectures that have dedicated stack manipulation instructions that assume a particular direction, so you may not always get to choose (for example, the Motorola 68000 MOVEM intstruction has register indirect with predecrement mode for source and register indirect with postincrement mode for destination operands, but not the other way 'round).

0

精彩评论

暂无评论...
验证码 换一张
取 消