crashbug fix in recent syslog-ng versions
Hi, I have found two problems which are the possible cause of the crashes reported on this list. expect a new release soon if the fixes below prove to be effective. The first one is a misallocation, causing an off-by-one error: diff -u -r1.35 sources.c --- sources.c 21 Aug 2002 14:03:50 -0000 1.35 +++ sources.c 27 Oct 2002 07:35:23 -0000 @@ -163,10 +163,10 @@ self->dgram = dgram; self->next = next; self->prefix = prefix; - self->max_log_line = MAX(max_log_line, pad_size) + 1; + self->max_log_line = MAX(max_log_line, pad_size); self->pad_size = pad_size; self->msg_flags = msg_flags; - self->buffer = ol_space_alloc(max_log_line); + self->buffer = ol_space_alloc(self->max_log_line); return &self->super; } ---- end of patch The second one is triggered with much less probability, it is also an off-by-one (this one can be triggered when the byte _after_ the allocated buffer is either '\n' or '\r'). diff -u -r1.27 -r1.28 --- log.c 21 Aug 2002 14:03:50 -0000 1.27 +++ log.c 18 Oct 2002 12:31:08 -0000 1.28 @@ -44,11 +44,9 @@ static void parse_log_msg(struct log_info *lm, UINT32 length, UINT8 *data, UINT8 *prefix) { unsigned char *src; - int left; - int pri; + unsigned int left, pri, oldleft; time_t now = time(NULL); char *oldsrc; - int oldleft; src = data; left = length; @@ -241,7 +239,7 @@ lm->stamp = now; } - for (oldsrc = src, oldleft = left; oldleft >= 0; oldleft--, oldsrc++) { + for (oldsrc = src, oldleft = left; oldleft > 0; oldleft--, oldsrc++) { if (*oldsrc == '\n' || *oldsrc == '\r') *oldsrc = ' '; } lm->msg = c_format_cstring("%z%s", prefix ? prefix : (UINT8 *) "", left, src); -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
Balazs Scheidler <bazsi@balabit.hu> wrote:
I have found two problems which are the possible cause of the crashes reported on this list. expect a new release soon if the fixes below prove to be effective.
I am very happy to report that 1.5.23+libol-0.3.5 are running just fine in my environment. Before I discovered 1.5.23 was available I had already tested 1.5.21+the sources.c patch, and that worked for me as well. Thanks very much for taking the time to stomp this bug out of existence!
I have found two problems which are the possible cause of the crashes reported on this list. expect a new release soon if the fixes below prove to be effective.
I am very happy to report that 1.5.23+libol-0.3.5 are running just fine in my environment. Before I discovered 1.5.23 was available I had already tested 1.5.21+the sources.c patch, and that worked for me as well.
Thanks very much for taking the time to stomp this bug out of existence!
cool, and thanks for testing the fix. if syslog-ng 1.5.23 proves to be stable, I'll release 1.6.0 Could you - not specifically you, rather the list - please test the configure.in changes as well on different platforms? I've tested it on Debian GNU/Linux, and Solaris 8 (Linux on x86, Solaris on Sparc). A test on one of the BSDs and HP-UX would be welcome. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
I have found two problems which are the possible cause of the crashes reported on this list. expect a new release soon if the fixes below prove to be effective.
I am very happy to report that 1.5.23+libol-0.3.5 are running just fine in my environment. Before I discovered 1.5.23 was available I had already tested 1.5.21+the sources.c patch, and that worked for me as well.
Thanks very much for taking the time to stomp this bug out of existence!
cool, and thanks for testing the fix. if syslog-ng 1.5.23 proves to be stable, I'll release 1.6.0
Could you - not specifically you, rather the list - please test the configure.in changes as well on different platforms?
Trying to build it on post-8.2-pre-9.0 Mandrake system with autoconf-2.13 resulted in Making all in src make[1]: Entering directory `/wrk/rpm/BUILD/syslog-ng-1.5.23/src' cd /wrk/rpm/BUILD/syslog-ng-1.5.23 && autoheader /usr/bin/autoheader-2.13: Symbol `HAVE_RES_INIT' is not covered by /usr/share/autoconf/acconfig.h ./acconfig.h FWIW the following patch seems to have fixed it: --- syslog-ng-1.5.23/acconfig.h.orig Wed Apr 3 12:37:02 2002 +++ syslog-ng-1.5.23/acconfig.h Tue Oct 29 17:00:12 2002 @@ -40,4 +40,5 @@ #undef PATH_SYSCONFDIR #undef ENABLE_TCP_WRAPPER - \ No newline at end of file + +#undef HAVE_RES_INIT -andrey
On Tue, Oct 29, 2002 at 05:06:32PM +0300, Borzenkov Andrey wrote:
Trying to build it on post-8.2-pre-9.0 Mandrake system with autoconf-2.13 resulted in
Making all in src make[1]: Entering directory `/wrk/rpm/BUILD/syslog-ng-1.5.23/src' cd /wrk/rpm/BUILD/syslog-ng-1.5.23 && autoheader /usr/bin/autoheader-2.13: Symbol `HAVE_RES_INIT' is not covered by /usr/share/autoconf/acconfig.h ./acconfig.h
FWIW the following patch seems to have fixed it:
thanks, applied -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
Balazs Scheidler <bazsi@balabit.hu> wrote:
I have found two problems which are the possible cause of the crashes reported on this list. expect a new release soon if the fixes below prove to be effective.
I am very happy to report that 1.5.23+libol-0.3.5 are running just fine in my environment. Before I discovered 1.5.23 was available I had already tested 1.5.21+the sources.c patch, and that worked for me as well.
Thanks very much for taking the time to stomp this bug out of existence!
cool, and thanks for testing the fix. if syslog-ng 1.5.23 proves to be stable, I'll release 1.6.0
Could you - not specifically you, rather the list - please test the configure.in changes as well on different platforms?
I've tested it on Debian GNU/Linux, and Solaris 8 (Linux on x86, Solaris on Sparc).
Now that you mention it... on Solaris 2.6 I had to use the attached patch for syslog-ng to build. On Solaris 8 I had to invoke configure this way in order to *really* disable res_init: /bin/env blb_cv_c_res_init=no ./configure --sysconfdir=/etc Otherwise, I ended up with this (notice there are two res_init() checks, and one succeeds): [...] checking for I_CONSLOG... yes checking for O_LARGEFILE... yes checking for res_init... yes checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for door_create in -ldoor... yes checking for select... yes checking for snprintf... yes checking for vsnprintf... yes checking for strerror... yes checking for inet_aton... no checking for strncpy... yes checking for getutent... yes checking for res_init... no checking for getopt_long... no checking for strcasecmp... yes checking for strptime... yes [...] Thanks.
On Tue, Oct 29, 2002 at 09:43:49AM -0500, William Yodlowsky wrote:
Balazs Scheidler <bazsi@balabit.hu> wrote:
Now that you mention it... on Solaris 2.6 I had to use the attached patch for syslog-ng to build. On Solaris 8 I had to invoke configure this way in order to *really* disable res_init:
/bin/env blb_cv_c_res_init=no ./configure --sysconfdir=/etc
Otherwise, I ended up with this (notice there are two res_init() checks, and one succeeds):
the two different checks are fixed now (the EGREP one remains, as it is the one which works on Linux) Why is this #include <arpa/nameser.h> needed? res_init() is not defined by <resolv.h> ? That might cause a warning, but it should still compile. (I only have solaris 8, and res_init() is defined by <resolv.h> -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
Balazs Scheidler <bazsi@balabit.hu> wrote:
On Tue, Oct 29, 2002 at 09:43:49AM -0500, William Yodlowsky wrote:
Balazs Scheidler <bazsi@balabit.hu> wrote:
Now that you mention it... on Solaris 2.6 I had to use the attached patch for syslog-ng to build. On Solaris 8 I had to invoke configure this way in order to *really* disable res_init:
/bin/env blb_cv_c_res_init=no ./configure --sysconfdir=/etc
Otherwise, I ended up with this (notice there are two res_init() checks, and one succeeds):
the two different checks are fixed now (the EGREP one remains, as it is the one which works on Linux)
Why is this #include <arpa/nameser.h> needed?
res_init() is not defined by <resolv.h> ?
That might cause a warning, but it should still compile. (I only have solaris 8, and res_init() is defined by <resolv.h>
On 2.6 it is too. The issue is actually a little different; sorry about the confusion... % uname -a SunOS ss5.example.com 5.6 Generic_105181-29 sun4m sparc SUNW,SPARCstation-5 % cd syslog-ng-1.5.23 % ./configure --with-libol=../libol-0.3.5 [snip] % make Making all in src make all-recursive Making all in . gcc -DHAVE_CONFIG_H -I. -I/tmp/syslog-ng-1.5.23/src -I. -Wall -I/tmp/libol-0.3.5/src -D_GNU_SOURCE -c main.c In file included from main.c:44: /usr/include/resolv.h:140: `MAXDNAME' undeclared here (not in a function) *** Error code 1 make: Fatal error: Command failed for target `main.o' Current working directory /tmp/syslog-ng-1.5.23/src *** Error code 1 make: Fatal error: Command failed for target `all-recursive' Current working directory /tmp/syslog-ng-1.5.23/src *** Error code 1 make: Fatal error: Command failed for target `all-recursive-am' Current working directory /tmp/syslog-ng-1.5.23/src *** Error code 1 make: Fatal error: Command failed for target `all-recursive' % MAXDNAME is defined inside arpa/nameser.h...
Hi, im running Linux Mandrake v9.0 and I have the same problem as the 9.0-pre Release. --------------SNIP----------------- [shane@linux syslog-ng-1.5.23]# rpm -qf $(which autoheader) autoconf-2.13-14mdk [shane@linux syslog-ng-1.5.23]# make Making all in src make[1]: Entering directory `/home/shane/syslog-ng/syslog-ng-1.5.23/src' cd /home/shane/syslog-ng/syslog-ng-1.5.23 && autoheader /usr/bin/autoheader-2.13: Symbol `HAVE_RES_INIT' is not covered by /usr/share/autoconf/acconfig.h ./acconfig.h make[1]: *** [/home/shane/syslog-ng/syslog-ng-1.5.23/src/stamp-h.in] Error 1 make[1]: Leaving directory `/home/shane/syslog-ng/syslog-ng-1.5.23/src' make: *** [all-recursive] Error 1 --------------SNIP----------------- The acconfig.h patch posted by andrey worked for me as well. -----Original Message----- From: syslog-ng-admin@lists.balabit.hu [mailto:syslog-ng-admin@lists.balabit.hu] On Behalf Of Balazs Scheidler Sent: Tuesday, October 29, 2002 4:55 AM To: syslog-ng@lists.balabit.hu Subject: Re: [syslog-ng]crashbug fix in recent syslog-ng versions
I have found two problems which are the possible cause of the crashes reported on this list. expect a new release soon if the fixes below prove to be effective.
I am very happy to report that 1.5.23+libol-0.3.5 are running just fine in my environment. Before I discovered 1.5.23 was available I had already tested 1.5.21+the sources.c patch, and that worked for me as well.
Thanks very much for taking the time to stomp this bug out of existence!
cool, and thanks for testing the fix. if syslog-ng 1.5.23 proves to be stable, I'll release 1.6.0 Could you - not specifically you, rather the list - please test the configure.in changes as well on different platforms? I've tested it on Debian GNU/Linux, and Solaris 8 (Linux on x86, Solaris on Sparc). A test on one of the BSDs and HP-UX would be welcome. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1 _______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng Frequently asked questions at http://www.campin.net/syslog-ng/faq.html --- Incoming mail has been scanned for viruses and is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.408 / Virus Database: 230 - Release Date: 10/24/02 --- This email has been scanned for viruses and is considered Virus-Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.408 / Virus Database: 230 - Release Date: 10/24/02
Compiles OK on AIX4.3.3 w/gcc 2.95.3, libol-0.3.5. I'm not sure if the following information is all that useful to you, but I suppose it tests the configuration system a little bit. Rebuilding configure script with automake-1.6.1 and autoconf-2.5.3: (These aren't totally current, but they're what I have on the system..) *** Running automake gives the following error first (reflecting that older *** version was used.) configure.in:5: old Automake version. You should recreate aclocal.m4 configure.in:5: with aclocal and run automake again. src/Makefile.am: required file `./depcomp' not found /usr/local/encap/automake-1.6.1/share/automake-1.6/am/depend2.am: AMDEP does not appear in AM_CONDITIONAL /usr/local/encap/automake-1.6.1/share/automake-1.6/am/depend2.am: AMDEP does not appear in AM_CONDITIONAL /usr/local/encap/automake-1.6.1/share/automake-1.6/am/depend2.am: AMDEP does not appear in AM_CONDITIONAL /usr/local/encap/automake-1.6.1/share/automake-1.6/am/lang-compile.am: AMDEP does not appear in AM_CONDITIONAL /usr/local/encap/automake-1.6.1/share/automake-1.6/am/depend2.am: AMDEP does not appear in AM_CONDITIONAL /usr/local/encap/automake-1.6.1/share/automake-1.6/am/depend2.am: AMDEP does not appear in AM_CONDITIONAL /usr/local/encap/automake-1.6.1/share/automake-1.6/am/depend2.am: AMDEP does not appear in AM_CONDITIONAL /usr/local/encap/automake-1.6.1/share/automake-1.6/am/lang-compile.am: AMDEP does not appear in AM_CONDITIONAL *** Corrected problem by running aclocal. Next, ran automake -ac, *** then autoconf. autoconf produced following warning: configure.in:162: error: do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs. LIBOBJS' *** Configure script works, and configured product ompiles OK So it seems that the Makefile.am and configure.in update alright to the newer autoconf and automake versions, save for the warning. configure.in:5: your implementation of AM_INIT_AUTOMAKE comes from an On Tue, Oct 29, 2002 at 09:25:01AM +0100, Balazs Scheidler wrote:
Could you - not specifically you, rather the list - please test the configure.in changes as well on different platforms?
-- Jonathan Marks Systems Administrator, Production Systems Group Campus Information Technologies and Educational Services University of Illinois at Urbana-Champaign
On Tue, Oct 29, 2002 at 11:11:51AM -0600, Jon Marks wrote:
Compiles OK on AIX4.3.3 w/gcc 2.95.3, libol-0.3.5.
I'm not sure if the following information is all that useful to you, but I suppose it tests the configuration system a little bit.
Rebuilding configure script with automake-1.6.1 and autoconf-2.5.3:
autoconf 2.5 is not completely comatible with 2.13, and my configure script has never been meant to be used with autoconf 2.5 I might switch to a newer autoconf with the next release though. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
My syslog-ng 1.5.21 on NetBSD 1.5.3 i386 took a core dump a couple of nights ago - backtrace is below. Bazsi, if you need any more diagnostic info, let me know. I'll probably attempt to upgrade to the current stuff soon, but thought I'd post this in case it wasn't caught yet. Core was generated by `syslog-ng'. Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/libexec/ld.elf_so...done. Reading symbols from /usr/lib/libwrap.so.0...done. Reading symbols from /usr/lib/libc.so.12...done. #0 0x8053a34 in gc_sweep () (gdb) bt #0 0x8053a34 in gc_sweep () #1 0x8053afb in gc () #2 0x8053b5e in gc_maybe () #3 0x8051fe0 in io_iter () #4 0x804a12d in main_loop (backend=0x805d000) at main.c:239 #5 0x804a78e in main (argc=7, argv=0xbfbfdd50) at main.c:514 #6 0x8049b89 in ___start ()
participants (6)
-
Balazs Scheidler
-
Borzenkov Andrey
-
Ed Ravin
-
Jon Marks
-
Shane Lahey
-
William Yodlowsky