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



>      #define MAXPACKET	(64*1024)

> I think it's related to a DNS query, so it might be the max size of a
> UDP packet?  (then why not 65kB?)

Because the max UDP packet size is 64k (well, 64k-1 - the length field
is 16 bits long).  The only places I see 65k are from people who
confuse storage kilobytes (1024 bytes) with communications (bandwidth,
etc) kilobytes or disk-manufacturer kilobytes (1000 bytes) - though
communications usually works in bits rather than bytes.

Interestingly, while 5.2's getaddrinfo() has something very similar (a
64k array on the stack), 1.4T's does not.

> And of course this also raises the stupid question: what should be
> the minimum stack size of a thread in NetBSD?

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).

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index