This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] attr.c in _STACK_GROWS_UP case.


On Sun, Dec 28, 2003 at 06:55:57PM -0500, Carlos O'Donell wrote:
> On Sun, Dec 28, 2003 at 03:32:52PM -0800, Roland McGrath wrote:
> > Don't you still need to do something to cap the size when the rlimit is
> > very high (e.g. ulimit -s unlimited)?
> 
> Unknown. I just assume that you get to keep allocating stack until you
> run off the end of the mapping and fault.
> 
> Shouldn't everyone be capping this to the other end of the vma?
> 
> e.g. 
>       attr->__stacksize = (size_t)to - (size_t)from;

No, because the VMA is growing.
But IMHO it makes sense to cap it by the end of the previous vma
(resp. for S_G_U beginning of next vma).
For S_G_D this means remembering to from previous VMA in last_to
(initialized to 0 at the beginning) and:
attr->__stacksize = rl.rlim_cur;
attr->__stackaddr = (void *) to;
if ((size_t) attr->__stacksize > (size_t) attr->__stackaddr - last_to)
  attr->__stacksize = (size_t) attr->__stackaddr - last_to;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]