tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: stack overflow in getaddrinfo(3) with a small-sized stack in pthreads
On Mon, Nov 29, 2021 at 07:49:26PM -0500, Matthew Mondor wrote:
> On Mon, 29 Nov 2021 00:05:18 +0100
> Anthony Mallet <anthony.mallet%laas.fr@localhost> wrote:
>
> > > Why should there be any particular minimum? It seems to me it
> > > depends on what the thread is doing (though one page, whatever that
> > > is on the hardware and release in question, is probably a pretty
> > > hard minimum).
> >
> > That's why I said my question is stupid :) If the thread returns
> > immediately, the minimum is 0 (or PTHREAD_STACK_MIN to account for
> > libpthread).
>
> If I remember correctly, the stacks are large by default but only use
> VM space, with pages only really allocated as usage grows. You could
> try tests without altering the size and see if it still performs as
> expected...
I got curious and took a look. Default pthread stack size is taken from
RLIMIT_STACK, which appears to default to 4MiB on amd64 at least.
--
Paul Ripke
"Great minds discuss ideas, average minds discuss events, small minds
discuss people."
-- Disputed: Often attributed to Eleanor Roosevelt. 1948.
Home |
Main Index |
Thread Index |
Old Index