[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] alloca

From: Paul Eggert
Subject: Re: [Bug-gnulib] alloca
Date: 13 Nov 2003 10:52:28 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Bruno Haible <address@hidden> writes:

> Paul Eggert wrote:
> >   Ideally, I'd like to see this "maximum safe alloca" value
> >   automatically configured.
> It's not related to the machine page size.

Doesn't this depend on what we mean by "safe"?

By "safe" I meant that, if the program runs out of stack space, the
implementation will determine this reliably and will terminate the
program (or send it a signal that the program can use to clean up, if
it uses the correct system calls ahead of time).  Ordinary alloca is
not safe in this sense, since one can issue an alloca that causes the
stack pointer to point to memory used for some other purpose, and the
resulting behavior is undefined.

It sounds like your definition of "safe" is something more like "we
know that the program won't run out of stack space".  That is a
stricter definition of "safe", one that would be nicer to have, but is
(as you say) application-dependent and harder to implement.

For starters, I'd be happy even with the less-strict definition of
"safe".  It really bothers me to think that many GNU programs can
invoke alloca in such a way that they can trash their internal buffers
without warning.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]