[syslog-ng] Segfault under RHEL4U2

Paul Krizak paul.krizak at amd.com
Tue Feb 28 20:17:16 CET 2006


Yes, I would never use an exiting program for a program destination, but 
the segfault was a Bad Thing that I was able to reproduce with the 
simple configuration I provided.  I ran across it because one of my 
scripts that I was using in a program destination had a syntax error and 
so would exit immediately after being started.  When that happened, 
syslog-ng would segfault and disappear, thus halting all logging 
operations on the machine.  Not good.

Thanks for the prompt response on getting the bug fixed!

Paul Krizak                         5900 E. Ben White Blvd. MS 625
Advanced Micro Devices              Austin, TX  78741
Linux/Unix Systems Engineering      Phone: (512) 602-8775
Microprocessor Solutions Sector     Cell:  (512) 791-0686


Balazs Scheidler wrote:
> On Mon, 2006-02-27 at 17:33 -0600, Paul Krizak wrote:
>> I just downloaded 1.9.9 and I'm getting a segfault for the following 
>> syslog-ng.conf:
>>
>> source s_external_syslog {
>>      udp(port(514));
>> };
>>
>> destination d_re_mce_aggregator {
>>      program(
>>          "/bin/true"
>>      );
>> };
>>
>> log {
>>      source(s_external_syslog);
>>      destination(d_re_mce_aggregator);
>> };
>>
> 
> The patch below should fix this (available in tomorrow's snapshot as
> well). It actually fixes another bug that prevents syslog-ng noticing
> exited programs (in order to restart them), but please notice that the
> configuration above will generate a lot of program executions
> as /bin/true will immediately exit without processing messages at all.
> 
> --- orig/ChangeLog
> +++ mod/ChangeLog
> @@ -2,6 +2,25 @@
>  # arch-tag: automatic-ChangeLog--devel at balabit.hu--other-1/syslog-ng--mainline--2.0
>  #
> 
> +2006-02-28 18:47:01 GMT        Balazs Scheidler <bazsi at balabit.hu>     patch-20
> +
> +    Summary:
> +      fixed possible abort in program destination
> +    Revision:
> +      syslog-ng--mainline--2.0--patch-20
> +
> +       * src/afprog.c (afprogram_dd_deinit): don't drop the reference to
> +       self->writer, only deinit it,
> +       (afprogram_dd_free): drop the reference to self->writer,
> +
> +       * src/main.c (main_loop_run): change the loop so that it actually
> +       processes exited children
> +
> +
> +    modified files:
> +     ChangeLog src/afprog.c src/main.c
> +
> +
>  2006-02-26 09:39:39 GMT        Balazs Scheidler <bazsi at balabit.hu>     patch-19
> 
>      Summary:
> 
> 
> --- orig/src/afprog.c
> +++ mod/src/afprog.c
> @@ -141,10 +141,7 @@ afprogram_dd_deinit(LogPipe *s, GlobalCo
>        self->pid = -1;
>      }
>    if (self->writer)
> -    {
> -      log_pipe_deinit(self->writer, NULL, NULL);
> -      log_pipe_unref(self->writer);
> -    }
> +    log_pipe_deinit(self->writer, NULL, NULL);
>    return TRUE;
>  }
> 
> @@ -153,7 +150,7 @@ afprogram_dd_free(LogPipe *s)
>  {
>    AFProgramDestDriver *self = (AFProgramDestDriver *) s;
> 
> -  g_assert(!self->writer);
> +  log_pipe_unref(self->writer);
>    g_string_free(self->cmdline, TRUE);
>    log_drv_free_instance(&self->super);
>    g_free(self);
> 
> 
> --- orig/src/main.c
> +++ mod/src/main.c
> @@ -172,14 +172,15 @@ main_loop_run(GlobalConfig *cfg)
>          }
>        if (sig_child_received)
>         {
> -         pid_t pid = 0;
> +         pid_t pid;
>           int status;
> 
> -         while (pid > 0)
> +          do
>             {
>               pid = waitpid(-1, &status, WNOHANG);
>               child_manager_sigchild(pid, status);
>             }
> +          while (pid > 0);
>           sig_child_received = FALSE;
>         }
>      }
> 
> 
> 



More information about the syslog-ng mailing list