Bill Allombert on Mon, 7 Apr 2003 23:50:51 +0200


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

Re: GMP kernel and stack abuse


On Mon, Apr 07, 2003 at 02:14:39PM -0700, Ilya Zakharevich wrote:
> On Mon, Apr 07, 2003 at 12:24:02PM +0200, Bill Allombert wrote:
> > I think it is in the FAQ:
> 
> In my experience, it is easier to fix such problems than again and
> again point to faq.

Since this bug occurs on all program I know that use GMP, I suspect
it is not easy to fix.

> >   Using the GMP kernel, my session dies on a huge division!
> > 
> >    This is a general problem in GMP, which may allocate a huge amount of
> >    memory in the process stack space (using alloca). The best solution so far
> >    is to increase the maximum size of the process stack segment before
> >    starting gp from the shell. Alternatively, you might wish to configure GMP
> >    with
> > 
> >      configure --enable-alloca=malloc-noreentrant
> > 
> >    but this will slow down GMP.
> 
> We *know* the stack limit.  Why not use this knowledge to substitute
> our alloca()?

Does not it require recompiling libgmp ?

The stack overflow here is of the order of tens of megabytes.

Cheers,
Bill.