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: MAXPACKET changes and Netscape java-vm


On Tue, Sep 24, 2002 at 03:48:14PM +0400, Dmitry V. Levin wrote:
> On Tue, Sep 24, 2002 at 01:41:41PM +0200, Thorsten Kukuk wrote:
> > We have 4 patches, where we increased the minimum value of
> > MAXPACKET from 1024 to 65536, to avoid a buffer overrun.
> > 
> > with this changes, the java vm from netscape crashes with a seg.fault,
> > if it calls gethostbyname(). It looks like it overrides the stack.
> 
> Yes, this MAXPACKET change breaks many existing threaded applications.
> For example, mysqld sets the size of created thread's stack to 64K
> (on ia32) by default.

This is not the only place in libc which allocates very large chunks
of stack (see e.g. *printf/*scanf family etc.).
The agreement was that there should be a
attribute_hidden __stack_alloca_cutoff variable which should be lowered
by setrlimit(RLIMIT_STACK, ) with small stack sizes
and all the
                /* The string `s2' might not be NUL terminated.  */
                if (prec < 32768)
                  string = (char *) alloca (prec);
                else if ((string = (char *) malloc (prec)) == NULL)
..
code use __stack_alloca_cutoff instead of the hardcoded cutoffs.

	Jakub


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