Re: cf_gen segfaults on FreeBSD-HEAD

From: Adrian Chadd <adrian@dont-contact.us>
Date: Sun, 16 Sep 2007 21:02:54 +0800

It wouldn't be the first time - Squid had to be compiled under -O0 for
so very long because of a random crash in the Squid internal DNS code;
the FreeBSD gcc was generating very very bogus argument handling code.

Wonder if something similar is going on here; try compiling it with -O0?

(I'll read the FreeBSD thread now.)

On Sun, Sep 16, 2007, Thomas-Martin Seck wrote:
> Squid folks,
>
> I am currently struggling with an odd issue with 2.6.STABLE16's cf_gen
> that (unfortunately) keeps me (or rather the assigned FreeBSD committer)
> from updating the FreeBSD port to 2.6.STABLE16. (In the meantime, we ship
> STABLE15 plus all official changesets.)
>
> The segfaults occur only on the HEAD FreeBSD branch (7-CURRENT). We
> tried to see whether this is a compiler issue (FreeBSD 7 will ship with
> gcc 4.2.1 as the system compiler while FreeBSD-6 uses 3.4.6) and found
> that it probably is not: on FreeBSD 6, cf_gen works even when gcc 4.2.1
> is used to compile Squid while on FreeBSD HEAD it always fails, even
> when compiling Squid with gcc 3.4. (It might be a more subtle compiler
> issue regarding system libraries nonetheless. I posted about this
> problem a week ago on the FreeBSD-current development list but got no
> reply so far.)
>
> I see the same issues with 3.0.PRE7 when it is patched up to changeset
> 11081; the info I get from the core is almost identical.
>
> Information from the core dump:
>
> GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "i386-marcel-freebsd"...
> Core was generated by `cf_gen'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /lib/libm.so.5...done.
> Loaded symbols for /lib/libm.so.5
> Reading symbols from /lib/libc.so.7...done.
> Loaded symbols for /lib/libc.so.7
> Reading symbols from /libexec/ld-elf.so.1...done.
> Loaded symbols for /libexec/ld-elf.so.1
> #0 0x28152226 in strcmp () from /lib/libc.so.7
> (gdb) bt
> #0 0x28152226 in strcmp () from /lib/libc.so.7
> #1 0x08048da6 in checkDepend (directive=0x282058c0 "external_acl_type",
> name=0xbfbfe11e "externalAclHelper", types=0x282025e0, entries=0x28207730)
> at cf_gen.c:133
> #2 0x08049524 in main (argc=3, argv=0xbfbfe5d4) at cf_gen.c:284
> (gdb) frame 2
> #2 0x08049524 in main (argc=3, argv=0xbfbfe5d4) at cf_gen.c:284
> 284 checkDepend(curr->name, ptr, types, entries);
> (gdb) p *curr
> $1 = {name = 0x282058c0 "external_acl_type", alias = 0x0, type = 0x0,
> loc = 0x0, default_value = 0x0, default_if_none = 0x0, comment = 0x0,
> ifdef = 0x0, doc = 0x0, nocomment = 0x0, array_flag = 0, next = 0x0}
> (gdb) p ptr
> $2 = 0xbfbfe11e "externalAclHelper"
> (gdb) p *types
> $3 = {name = 0x282025f0 "errormap", depend = 0x0, next = 0x282025d0}
> (gdb) p *entries
> $4 = {name = 0x282069f0 "comment", alias = 0x0, type = 0x0,
> loc = 0x282069f8 "none", default_value = 0x0, default_if_none = 0x0,
> comment = 0x0, ifdef = 0x0, doc = 0x28206a00, nocomment = 0x0,
> array_flag = 0, next = 0x28207700}
> (gdb) frame 1
> #1 0x08048da6 in checkDepend (directive=0x282058c0 "external_acl_type",
> name=0xbfbfe11e "externalAclHelper", types=0x282025e0, entries=0x28207730)
> at cf_gen.c:133
> 133 if (strcmp(entry->name, dep->name) == 0)
> (gdb) p *entry
> $5 = {name = 0x282069f0 "comment", alias = 0x0, type = 0x0,
> loc = 0x282069f8 "none", default_value = 0x0, default_if_none = 0x0,
> comment = 0x0, ifdef = 0x0, doc = 0x28206a00, nocomment = 0x0,
> array_flag = 0, next = 0x28207700}
> (gdb) p *dep
> $6 = {name = 0x22a02270 <Address 0x22a02270 out of bounds>, next = 0x235022d0}
> (gdb) quit
>
> --
> Best regards,
> Thomas-Martin Seck (current FreeBSD Squid maintainer)

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $25/pm entry-level bandwidth-capped VPSes available in WA -
Received on Sun Sep 16 2007 - 06:58:38 MDT

This archive was generated by hypermail pre-2.1.9 : Mon Oct 01 2007 - 12:00:05 MDT