[Mimedefang] again - Overlong line in RESULTS file

Martin Blapp mb at imp.ch
Wed Sep 22 11:11:21 EDT 2004


Hi,

> I'm debugging the problem with a segfault and a 16k buffer on FreeBSD right now.
> Raising the buffer to 10k worked fine, but 16 seems to have problems.

(gdb) bt
#0  0x28102da3 in getdiskbyname (name=0x5d <Address 0x5d out of bounds>) at
/usr/src/lib/libc/gen/disklabel.c:114
#1  0x0805057c in ?? ()
#2  0x00000005 in ?? ()
#3  0xbfbfea40 in ?? ()
#4  0x00000000 in ?? ()
#5  0xbfbfe9c0 in ?? ()
#6  0xbfbfe9b8 in ?? ()

Uhm. Something very bad happens here: Stack corruption and it looks like a stack
overflow. The stack limit in libc_r or libpthreads in FreeBSD is 65536 and it is
likely that we hit it here. So I experimentally raised the stack size for
threaded apps in /usr/src/lib/libpthread/thread/thr_private.h to 128k:

#define THR_STACK_DEFAULT                       131072

recompiled the pthread lib and now it works. That means it is not save here
to place SMALLBUF on the stack. I'll try to convert it to malloc().

Agreed David ?

Martin



More information about the MIMEDefang mailing list