Minor headaches using pkgsrc daemons (samba)

walt wa1ter at myrealbox.com
Tue Jul 12 06:13:50 PDT 2005

On Tue, 12 Jul 2005, YONETANI Tomokazu wrote:

> On Sun, Jul 10, 2005 at 05:40:32PM -0700, walt wrote:
> > smbd: stack overflow in function open_sockets_smbd
> > kernel: pid 907 (smbd), uid 0: exited on signal 6

> If you leave out the -O flag (which is set to -O2 via CFLAGS which is
> by default ${DBG}) and it stops crashing.  And this doesn't seem to be
> a strict-aliasing bug as it still crashes with -fno-strict-aliasing
> flag.
> # env DBG='' bmake install				# didn't crash
> # env DBG='-g' bmake install				# didn't crash
> # env DBG='-O' bmake install				# crashed
> # env DBG='-O -fno-strict-aliasing' bmake install	# crashed

Excellent detective work, as always :o)  Just for fun I tried compiling
the ports version (which uses -O and has the same bug) and then deleted
smbd/server.o and removed the -O from the appropriate Makefile, and then
finished the build (so only server.c was re-compiled).

This also fixed the crashing, so there is something specific to the
file 'server.c' which can't tolerate optimizing.  Do you think the gnu
gcc people would like to be notified?  It certainly sounds like a gcc
bug to me.

(BTW, the gcc 3.3.3 on NetBSD-CURRENT apparently doesn't have the
stack-smash-protector, which I suppose is why samba works on NetBSD.)

More information about the Bugs mailing list