James Tison wrote:

>The gcc package can be configured to have the stack grow either way, and if
>my light perusals of the kernel code (and my memory) are right, so can
>Linux. I would have to think that the final decision would have to do with
>memory mapping, guard pages, and vmm controls, as well as the stack frame
>format & register mapping, of course -- more or less a matter of choice on
>ESAME hardware. I don't know why a downstack was chosen. Fortunately, there
>are people who chime in on this list all the time who have the definite
>answers. If they'd care to share them, I'm kind of curious too. :-)

I don't think there are really strong arguments for either direction
of stack growth on s390.  I don't really buy either the efficiency
or the security argument: efficiency comes with a well-designed calling
convention, and I think you can find those for either direction; as to
security, while an upwards-growing stack might make some attacks
more difficult, you can find other types of attacks.  In the end,
as long as you face security exposures due to bugs in applications,
the only sure way to deal with them is to fix those bugs; everything
else is a temporary band-aid of questionable value IMHO.
(And if you really want such band-aids, there are also some available
for the downwards-growing stack, like kernel patches to make the
stack non-executable or compiler patches to protect the return address
with 'canaries' or the like ...)

That said, as long as there is no overriding reason, there is
always the general principle: Don't Be Different.  We've always
tried to make the s390 variant of Linux as similiar as possible
to the other Linux variants in wide-spread use, foremost of course
the Intel version.  While in theory applications should not
depend on platform implementation issues like the direction of
stack growth, in practice there are always some that break.
(I think HPPA did go the upwards-growing stack way after all,
and there have been quite a few problems surfacing ...)

As one of main advantages of Linux on s390 is the easy portability
of so many applications from Linux on other platforms, it's really
important to try not to make that porting unnecessarily harder.
Therefore e.g. the application address space layout (including the
position and direction of the stack) on Linux for s390 is nearly
identical to the one on Linux/Intel, except that we have only 2 GB
instead of 3 GB (and even *that* difference actually caused applications
to break).

Bye,
Ulrich

--
  Dr. Ulrich Weigand
  [EMAIL PROTECTED]

Reply via email to