[syslog-ng] 3.2 alpha 2 build error

Martin Holste mcholste at gmail.com
Sat Aug 21 00:15:05 CEST 2010


Ah, oops, guess I didn't read too far!  Anyway, hopefully my short gdb
explanation helps someone else out.

Yes, the problem is definitely in the memtrace functions, as laid out
by the valgrind output.  There aren't too many calls inside that
faulting code block, so it must be a problem as the stack is walked
back until backtrace[i] is invalid.  It looks to me like you wouldn't
want memtrace enabled by default as it would be unnecessary overhead,
so if you can get it work without, I'd stick with that.

On Fri, Aug 20, 2010 at 4:11 PM, Matthew Hall <mhall at mhcomputing.net> wrote:
> Hello Martin,
>
> Below I did already attach the GDB backtrace. It just did not contain
> very much info, either due to memory corruption or a lack of debug
> symbols in the part of the code with the fault. Therefore I also
> attached the valgrind backtrace. Hopefully somebody who knows how the
> --enable-memtrace option works could have a look.
>
> Matthew.
>
> On Fri, Aug 20, 2010 at 03:26:43PM -0500, Martin Holste wrote:
>> Glad to hear it's mostly working.  In a pinch, you can always run the
>> program under gdb (remember to use "set args" on any params after the
>> program name) and then use "bt" to get a somewhat helpful backtrace.
>> It usually is enough to nail down the general area of code that is
>> having an issue.  So if your command normally looks like this:
>> "bin/pdbtool test -p var/patterndb.xml"
>> you would run
>> "gdb bin/pdbtool"
>> then
>> "set args test -p var/patterndb.xml" inside gdb
>> and finally
>> "bt" (or whatever) when it segfaults.
>>
>> On Fri, Aug 20, 2010 at 1:21 PM, Matthew Hall <mhall at mhcomputing.net> wrote:
>> > On Thu, Aug 19, 2010 at 08:53:28PM -0500, Martin Holste wrote:
>> >> Output of ldd pdbtool and ldconfig -v | grep libsyslog-ng ?
>> >
>> > Thanks for offering to help again Martin. Sorry for the delayed reply. I
>> > had to leave work before I got your response.
>> >
>> > ldd is showing it cannot find the library. Rerunning ldconfig as you
>> > suggested appears to fix the library problem, although it does not
>> > explain the Debian-style build failure from before. Now that the library
>> > links OK, I am seeing a segmentation fault. I recompiled with export
>> > CFLAGS='-g' but still not getting much of a backtrace. valgrind output
>> > looks better.
>> >
>> > I am suspecting the --enable-memtrace build option is responsible based
>> > on what I see in the valgrind output. I just recompiled without that
>> > option and pdbtool works fine now. Therefore I suspect there is a
>> > problem with this option or perhaps I do not understand what it's
>> > supposed to do.
>> >
>> > Cheers,
>> > Matthew.
>> >
>> > Program received signal SIGSEGV, Segmentation fault.
>> > 0x0000000000000000 in ?? ()
>> > (gdb) bt
>> > #0  0x0000000000000000 in ?? ()
>> > #1  0x00007ffff5852573 in z_malloc (size=100, backtrace=0x7fffffffdb80)
>> >    at memtrace.c:451
>> > #2  0x00007ffff5852eb1 in malloc (size=100) at memtrace.c:565
>> > #3  0x00007ffff41802f9 in _IO_vasprintf (result_ptr=0x7fffffffdfc8,
>> >    format=0x7fffffffdb80 "\200\335\377\377\377\177", args=0x0)
>> >    at vasprintf.c:52
>> > #4  0x00007ffff41646f8 in ___asprintf (string_ptr=0x84,
>> >    format=0x7fffffffdb80 "\200\335\377\377\377\177") at asprintf.c:37
>> > #5  0x00007ffff4140903 in *__GI___assert_fail (
>> >    assertion=0x7ffff589311a "temp_brk < 32768", file=<value optimized out>,
>> >    line=542, function=0x7ffff589312b "z_calloc") at assert.c:63
>> > #6  0x00007ffff5852d79 in z_calloc (nmemb=35340, size=1,
>> >    backtrace=0x7fffffffe060) at memtrace.c:542
>> > #7  0x00007ffff5853035 in calloc (nmemb=35340, size=1) at memtrace.c:593
>> > #8  0x00007ffff41fd463 in __monstartup (lowpc=<value optimized out>,
>> >    highpc=<value optimized out>) at gmon.c:136
>> > #9  0x0000000000403121 in __gmon_start__ ()
>> > #10 0x00007ffff3d0c232 in ?? () from /lib/libattr.so.1
>> > #11 0x00007fffffffe318 in ?? ()
>> > #12 0x00007ffff3d0c099 in _init () from /lib/libattr.so.1
>> > #13 0x00007ffff7fe7988 in ?? ()
>> > #14 0x00007ffff7dead65 in call_init (main_map=0x7ffff7ffe128, argc=1,
>> >    argv=0x7fffffffe318, env=0x7fffffffe328) at dl-init.c:70
>> > #15 _dl_init (main_map=0x7ffff7ffe128, argc=1, argv=0x7fffffffe318,
>> >    env=0x7fffffffe328) at dl-init.c:134
>> > #16 0x00007ffff7ddcb2a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
>> > #17 0x0000000000000001 in ?? ()
>> > #18 0x00007fffffffe5d5 in ?? ()
>> > #19 0x0000000000000000 in ?? ()
>> >
>> > valgrind output
>> >
>> > ==26840== Conditional jump or move depends on uninitialised value(s)
>> > ==26840==    at 0x4E7497D: z_mem_trace_bt (memtrace.c:157)
>> > ==26840==    by 0x4E76E85: malloc (memtrace.c:564)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> > ==26840==    by 0x403120: __gmon_start__ (in /usr/local/bin/pdbtool)
>> > ==26840==    by 0x8CFB231: ??? (in /lib/libattr.so.1.1.0)
>> > ==26840==
>> > ==26840== Conditional jump or move depends on uninitialised value(s)
>> > ==26840==    at 0x4E7495F: z_mem_trace_bt (memtrace.c:157)
>> > ==26840==    by 0x4E76E85: malloc (memtrace.c:564)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> > ==26840==    by 0x403120: __gmon_start__ (in /usr/local/bin/pdbtool)
>> > ==26840==    by 0x8CFB231: ??? (in /lib/libattr.so.1.1.0)
>> > ==26840==
>> > ==26840== Jump to the invalid address stated on the next line
>> > ==26840==    at 0x0: ???
>> > ==26840==    by 0x4E76EB0: malloc (memtrace.c:565)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> > ==26840==    by 0x403120: __gmon_start__ (in /usr/local/bin/pdbtool)
>> > ==26840==    by 0x8CFB231: ??? (in /lib/libattr.so.1.1.0)
>> > ==26840==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
>> > ==26840==
>> > ==26840==
>> > ==26840== Process terminating with default action of signal 11 (SIGSEGV)
>> > ==26840==  Bad permissions for mapped region at address 0x0
>> > ==26840==    at 0x0: ???
>> > ==26840==    by 0x4E76EB0: malloc (memtrace.c:565)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> > ==26840==    by 0x403120: __gmon_start__ (in /usr/local/bin/pdbtool)
>> > ==26840==    by 0x8CFB231: ??? (in /lib/libattr.so.1.1.0)
>> > ==26840== Conditional jump or move depends on uninitialised value(s)
>> > ==26840==    at 0x4E7497D: z_mem_trace_bt (memtrace.c:157)
>> > ==26840==    by 0x4E76EFD: free (memtrace.c:573)
>> > ==26840==    by 0x88A5241: ??? (in /lib/libc-2.11.1.so)
>> > ==26840==    by 0x4A236AB: _vgnU_freeres (vg_preloaded.c:62)
>> > ==26840==    by 0x4E76572: z_malloc (memtrace.c:451)
>> > ==26840==    by 0x4E76EB0: malloc (memtrace.c:565)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> > ==26840==
>> > ==26840== Conditional jump or move depends on uninitialised value(s)
>> > ==26840==    at 0x4E7495F: z_mem_trace_bt (memtrace.c:157)
>> > ==26840==    by 0x4E76EFD: free (memtrace.c:573)
>> > ==26840==    by 0x88A5241: ??? (in /lib/libc-2.11.1.so)
>> > ==26840==    by 0x4A236AB: _vgnU_freeres (vg_preloaded.c:62)
>> > ==26840==    by 0x4E76572: z_malloc (memtrace.c:451)
>> > ==26840==    by 0x4E76EB0: malloc (memtrace.c:565)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> > ==26840==
>> > ==26840== Jump to the invalid address stated on the next line
>> > ==26840==    at 0x0: ???
>> > ==26840==    by 0x4E76F28: free (memtrace.c:574)
>> > ==26840==    by 0x88A5241: ??? (in /lib/libc-2.11.1.so)
>> > ==26840==    by 0x4A236AB: _vgnU_freeres (vg_preloaded.c:62)
>> > ==26840==    by 0x4E76572: z_malloc (memtrace.c:451)
>> > ==26840==    by 0x4E76EB0: malloc (memtrace.c:565)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> > ==26840==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
>> > ==26840==
>> > ==26840==
>> > ==26840== Process terminating with default action of signal 11 (SIGSEGV)
>> > ==26840==  Bad permissions for mapped region at address 0x0
>> > ==26840==    at 0x0: ???
>> > ==26840==    by 0x4E76F28: free (memtrace.c:574)
>> > ==26840==    by 0x88A5241: ??? (in /lib/libc-2.11.1.so)
>> > ==26840==    by 0x4A236AB: _vgnU_freeres (vg_preloaded.c:62)
>> > ==26840==    by 0x4E76572: z_malloc (memtrace.c:451)
>> > ==26840==    by 0x4E76EB0: malloc (memtrace.c:565)
>> > ==26840==    by 0x87DF2F8: vasprintf (vasprintf.c:52)
>> > ==26840==    by 0x87C36F7: asprintf (asprintf.c:37)
>> > ==26840==    by 0x879F902: __assert_fail (assert.c:63)
>> > ==26840==    by 0x4E76D78: z_calloc (memtrace.c:542)
>> > ==26840==    by 0x4E77034: calloc (memtrace.c:593)
>> > ==26840==    by 0x885C462: monstartup (gmon.c:136)
>> >
>> > megahall at ubuntu:~$ sudo ldconfig -v | egrep '(:$|libsyslog-ng)'
>> > ...
>> > /usr/local/lib:
>> >        libsyslog-ng.so.0 -> libsyslog-ng.so.0.0.0
>> > ...
>> > megahall at ubuntu:~$ ldd $(which pdbtool)
>> >        linux-vdso.so.1 =>  (0x00007fff087ff000)
>> >        libsyslog-ng.so.0 => not found
>> >        libdbparser.so.0 => /usr/local/lib/syslog-ng/libdbparser.so.0 (0x00007fa72604e000)
>> >        libnsl.so.1 => /lib/libnsl.so.1 (0x00007fa725e33000)
>> >        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00007fa725c2f000)
>> >        librt.so.1 => /lib/librt.so.1 (0x00007fa725a27000)
>> >        libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007fa725748000)
>> >        libevtlog.so.0 => /usr/lib/libevtlog.so.0 (0x00007fa725543000)
>> >        libcap.so.2 => /lib/libcap.so.2 (0x00007fa72533e000)
>> >        libpcre.so.3 => /lib/libpcre.so.3 (0x00007fa72510f000)
>> >        libpthread.so.0 => /lib/libpthread.so.0 (0x00007fa724ef2000)
>> >        libc.so.6 => /lib/libc.so.6 (0x00007fa724b6f000)
>> > ***     libsyslog-ng.so.0 => not found
>> >        libdl.so.2 => /lib/libdl.so.2 (0x00007fa72496a000)
>> >        /lib64/ld-linux-x86-64.so.2 (0x00007fa726279000)
>> >        libattr.so.1 => /lib/libattr.so.1 (0x00007fa724764000)
>> > megahall at ubuntu:~$
>> >
>> >
>> >
>> >> On Thu, Aug 19, 2010 at 8:44 PM, Matthew Hall <mhall at mhcomputing.net> wrote:
>> >> > More information. When I compiled it by hand, it cannot find its libraries.
>> >> >
>> >> > I checked /etc/ld.so.conf.d/ and /usr/local/lib is included as expected
>> >> > for Debian and Ubuntu, and the library exists also.
>> >> >
>> >> > megahall at ubuntu:~/syslog-ng-3.2alpha2$ sudo find / -iname libsyslog-ng.so.0 -print
>> >> > /home/megahall/syslog-ng-3.2alpha2/src/.libs/libsyslog-ng.so.0
>> >> > /usr/local/lib/libsyslog-ng.so.0
>> >> > megahall at ubuntu:~/syslog-ng-3.2alpha2$ pdbtool
>> >> > pdbtool: error while loading shared libraries: libsyslog-ng.so.0: cannot open shared object file: No such file or directory
>> >> > megahall at ubuntu:~/syslog-ng-3.2alpha2$
>> >> >
>> >> > Enabling these options made no difference:
>> >> >
>> >> > --enable-shared --enable-dynamic-linking
>> >> >
>> >> > nm indicates that the library has symbols so it's not corrupt.
>> >> >
>> >> > file indicates that the arch is valid so it wasn't misbuilt for 32 bit.
>> >> >
>> >> > /usr/local/lib/libsyslog-ng.so.0.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
>> >> >
>> >> > Not sure what to try next on this one.
>> >> >
>> >> > Matthew.
>> >> >
>> >> > On Thu, Aug 19, 2010 at 06:25:55PM -0700, Matthew Hall wrote:
>> >> >> More information.
>> >> >>
>> >> >> Host OS is Kubuntu 10.04 LTS.
>> >> >>
>> >> >> Version of libdbi0 is 0.8.2-3.
>> >> >>
>> >> >> Builds successfully with --disable-sql added to configure in debian/rules.
>> >> >>
>> >> >> However packaging will fail with the following:
>> >> >>
>> >> >> dpkg-shlibdeps: error: couldn't find library libsyslog-ng.so.0 needed by debian/syslog-ng/bin/pdbtool (ELF format: 'elf64-x86-64'; RPATH: '//lib://lib/syslog-ng').
>> >> >> Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.
>> >> >> To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.
>> >> >> dh_shlibdeps: dpkg-shlibdeps -Tdebian/syslog-ng.substvars debian/syslog-ng/sbin/syslog-ng debian/syslog-ng/bin/loggen debian/syslog-ng/bin/pdbtool returned exit code 2
>> >> >> make: *** [binary-arch] Error 9
>> >> >>
>> >> >> Matthew.
>> >> >>
>> >> >> On Thu, Aug 19, 2010 at 06:16:39PM -0700, Matthew Hall wrote:
>> >> >> > When building using debian/rules binary on 3.2 alpha 2 my build fails
>> >> >> > here. Any advice on this one?
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Matthew.
>> >> >> >
>> >> >> > /bin/bash ../../libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../..  -I../../src -I.. -DENABLE_SQL=1 -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -I/usr/include/eventlog     -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -I/usr/include -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -g -O2 -Wall -MT libafsql_la-afsql.lo -MD -MP -MF .deps/libafsql_la-afsql.Tpo -c -o libafsql_la-afsql.lo `test -f 'afsql.c' || echo './'`afsql.c
>> >> >> > libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../src -I.. -DENABLE_SQL=1 -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/eventlog -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -I/usr/include -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -Wall -MT libafsql_la-afsql.lo -MD -MP -MF .deps/libafsql_la-afsql.Tpo -c afsql.c  -fPIC -DPIC -o .libs/libafsql_la-afsql.o
>> >> >> > afsql.c:120: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dbi_instance’
>> >> >> > afsql.c: In function ‘afsql_dd_insert_db’:
>> >> >> > afsql.c:583: warning: implicit declaration of function ‘dbi_conn_new_r’
>> >> >> > afsql.c:583: error: ‘dbi_instance’ undeclared (first use in this function)
>> >> >> > afsql.c:583: error: (Each undeclared identifier is reported only once
>> >> >> > afsql.c:583: error: for each function it appears in.)
>> >> >> > afsql.c: In function ‘afsql_dd_init’:
>> >> >> > afsql.c:1007: warning: implicit declaration of function ‘dbi_initialize_r’
>> >> >> > afsql.c:1007: error: ‘dbi_instance’ undeclared (first use in this function)
>> >> >> >
>> >> >> > ______________________________________________________________________________
>> >> >> > Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> >> >> > Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>> >> >> > FAQ: http://www.campin.net/syslog-ng/faq.html
>> >> >> >
>> >> >> ______________________________________________________________________________
>> >> >> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> >> >> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>> >> >> FAQ: http://www.campin.net/syslog-ng/faq.html
>> >> >>
>> >> > ______________________________________________________________________________
>> >> > Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> >> > Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>> >> > FAQ: http://www.campin.net/syslog-ng/faq.html
>> >> >
>> >> >
>> >> ______________________________________________________________________________
>> >> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> >> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>> >> FAQ: http://www.campin.net/syslog-ng/faq.html
>> >>
>> > ______________________________________________________________________________
>> > Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> > Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>> > FAQ: http://www.campin.net/syslog-ng/faq.html
>> >
>> >
>> ______________________________________________________________________________
>> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>> FAQ: http://www.campin.net/syslog-ng/faq.html
>>
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.campin.net/syslog-ng/faq.html
>
>


More information about the syslog-ng mailing list