[syslog-ng] segfaults with 1.9.x series syslog-ng and stream socket

func tionate functionate at gmail.com
Sat Jun 24 00:42:00 CEST 2006


I have written a sql stream socket daemon that for now is listening on
/var/tmp/syslog-socket and passes inserts to child processes. Starting
syslog-ng up with this socket as a destination on both the latest beta
release and today's cvs of 1.9.x (2.0rc1) cause it to bomb out with a
segfault. I have tested this both on an x86_64 linux gentoo amd64 box
and a centos 4 i386 xeon box. I have used the same stream socket
daemon with the latest 1.6 release and it has been reliable. I have
configured syslog-ng and built it with stock ./configure. also, when i
pull out the stream socket and associated config and start the daemon,
everything works as expected.

 Below I've included the only deviations from the syslog-ng.conf
RedHat config from the contrib directory (and the source definition
for clarity), and an strace. Please let me know if there is any
further info i can provide. (some cleansing of node names was done for
obvious reasons)

 Regards,

 Chris

 source s_sys { file ("/proc/kmsg" log_prefix("kernel: "));
unix-stream ("/dev/log"); internal(); };

 destination syslog-stream {
   unix-stream("/var/tmp/syslog-socket"
     template("INSERT INTO logs (host, facility, priority, level, tag, date,
     time, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY',
'$LEVEL','$TAG',
     '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$PROGRAM', '$MSG' );\n")
template_escape(yes)
   ) ;
 };

 log { source(s_sys); destination(syslog-stream); };




 root at host-1 [/usr/local/sbin] # /usr/bin/strace syslog-ng
 execve("/usr/local/sbin/syslog-ng", ["syslog-ng"], [/* 20 vars */]) = 0
 uname({sys="Linux", node="host-1.domain.com", ...}) = 0
 brk(0)                                  = 0x934f000
 access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
 open("/etc/ld.so.cache", O_RDONLY)      = 3
 fstat64(3, {st_mode=S_IFREG|0644, st_size=50262, ...}) = 0
 old_mmap(NULL, 50262, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7ff3000
 close(3)                                = 0
 open("/lib/libnsl.so.1", O_RDONLY)      = 3
 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320dH\000"...,
512) = 512
 fstat64(3, {st_mode=S_IFREG|0755, st_size=95148, ...}) = 0
 old_mmap(0x483000, 88064, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x483000
 old_mmap(0x495000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11000) = 0x495000
 old_mmap(0x497000, 6144, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x497000
 close(3)                                = 0
 open("/lib/tls/librt.so.1", O_RDONLY)   = 3
 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320P,\000"...,
512) = 512
 fstat64(3, {st_mode=S_IFREG|0755, st_size=47671, ...}) = 0
 old_mmap(0x2c3000, 81656, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2c3000
 old_mmap(0x2cb000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x2cb000
 old_mmap(0x2cd000, 40696, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2cd000
 close(3)                                = 0
 open("/lib/tls/libc.so.6", O_RDONLY)    = 3
 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20_\24"..., 512) = 512
 fstat64(3, {st_mode=S_IFREG|0755, st_size=1454546, ...}) = 0
 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xb7ff2000
 old_mmap(0x131000, 1219772, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x131000
 old_mmap(0x255000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x124000) = 0x255000
 old_mmap(0x259000, 7356, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x259000
 close(3)                                = 0
 open("/lib/tls/libpthread.so.0", O_RDONLY) = 3
 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\350)\000"...,
512) = 512
 fstat64(3, {st_mode=S_IFREG|0755, st_size=93985, ...}) = 0
 old_mmap(0x29a000, 70108, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x29a000
 old_mmap(0x2a8000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd000) = 0x2a8000
 old_mmap(0x2aa000, 4572, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2aa000
 close(3)                                = 0
 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xb7ff1000
 mprotect(0x255000, 4096, PROT_READ)     = 0
 mprotect(0x12d000, 4096, PROT_READ)     = 0
 set_thread_area({entry_number:-1 -> 6, base_addr:0xb7ff16c0,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
 munmap(0xb7ff3000, 50262)               = 0
 set_tid_address(0xb7ff1708)             = 31245
 rt_sigaction(SIGRTMIN, {0x29e380, [], SA_RESTORER|SA_SIGINFO,
0x2a5880}, NULL, 8) = 0
 rt_sigaction(SIGRT_1, {0x29e3f0, [],
SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x2a5880}, NULL, 8) = 0
 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
 getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0
 _sysctl({{CTL_KERN, KERN_VERSION, 0, 20d91, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2,
0xbfe4743c, 34, (nil), 0}) = 0
 brk(0)                                  = 0x934f000
 brk(0x9370000)                          = 0x9370000
 open("/etc/localtime", O_RDONLY)        = 3
 fstat64(3, {st_mode=S_IFREG|0644, st_size=1267, ...}) = 0
 fstat64(3, {st_mode=S_IFREG|0644, st_size=1267, ...}) = 0
 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xb7fff000
 read(3, "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0\4\0"...,
4096) = 1267
 close(3)                                = 0
 munmap(0xb7fff000, 4096)                = 0
 rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
 rt_sigaction(SIGHUP, {0x804a814, [], SA_RESTORER, 0x1588e8}, NULL, 8) = 0
 rt_sigaction(SIGTERM, {0x804a824, [], SA_RESTORER, 0x1588e8}, NULL, 8) = 0
 rt_sigaction(SIGINT, {0x804a824, [], SA_RESTORER, 0x1588e8}, NULL, 8) = 0
 rt_sigaction(SIGCHLD, {0x804a84c, [], SA_RESTORER, 0x1588e8}, NULL, 8) = 0
 rt_sigaction(SIGSEGV, {0x804a834, [], SA_RESTORER|SA_ONESHOT,
0x1588e8}, NULL, 8) = 0
 open("/etc/eventlog.conf", O_RDONLY)    = -1 ENOENT (No such file or directory)
 open("/usr/local/etc/syslog-ng.conf", O_RDONLY) = 3
 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfe473f8) = -1 ENOTTY
(Inappropriate ioctl for device)
 fstat64(3, {st_mode=S_IFREG|0644, st_size=3080, ...}) = 0
 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xb7fff000
 read(3, "# syslog-ng configuration file.\n"..., 8192) = 3080
 read(3, "", 4096)                       = 0
 read(3, "", 8192)                       = 0
 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfe46eb8) = -1 ENOTTY
(Inappropriate ioctl for device)
 close(3)                                = 0
 munmap(0xb7fff000, 4096)                = 0
 open("/proc/kmsg", O_RDONLY|O_NONBLOCK|O_NOCTTY|O_LARGEFILE) = 3
 fcntl64(3, F_GETFD)                     = 0
 fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
 socket(PF_FILE, SOCK_STREAM, 0)         = 4
 fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
 fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
 fcntl64(4, F_GETFD)                     = 0
 fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
 stat64("/dev/log", {st_mode=S_IFSOCK|0666, st_size=0, ...}) = 0
 unlink("/dev/log")                      = 0
 bind(4, {sa_family=AF_FILE, path="/dev/log"}, 11) = 0
 listen(4, 255)                          = 0
 chmod("/dev/log", 0666)                 = 0
 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
 kill(31245, SIGSEGV)                    = 0
 sigreturn()                             = ? (mask now [])
 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
 +++ killed by SIGSEGV +++
 Process 31245 detached
 root at host-1 [/usr/local/sbin] # ./syslog-ng --version
 syslog-ng 2.0rc1
 root at host-1 [/usr/local/sbin] # uname -a
 Linux host-1.domain.com 2.6.9-11.ELsmp #1 SMP Wed Jun 8 17:54:20 CDT
2005 i686 i686 i386 GNU/Linux


More information about the syslog-ng mailing list