runit/svlogd: segfault, uninitialized strallocs?

From: mcz <emcze_at_ya.ru>
Date: Mon, 15 Jan 2018 01:18:59 +0100

On one of my PCs (runit-2.1.2, voidlinux, raspberry pi) this happens
when the number of logdir arguments is large enough:

---8<---
# strace svlogd -ttt /var/log/socklog/*
[...]
open("/var/log/socklog/daemon", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
fchdir(4) = 0
open("lock", O_WRONLY|O_CREAT|O_APPEND|O_NONBLOCK|O_LARGEFILE, 0600) = 5
flock(5, LOCK_EX|LOCK_NB) = 0
fcntl64(5, F_SETFD, FD_CLOEXEC) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x68732067} ---
+++ killed by SIGSEGV +++
Segmentation fault
#
---8<---

The dir structures (which are allocated at svlogd.c:706) don't seem to
be zeroed at all when alloc falls back to malloc (alloc.c:21). Then,
uninitialized dir[0].prefix gets passed to stralloc_copys
(svlogd.c:435) and svlogd receives SIGSEGV at stralloc_opyb.c:11.

Is this a bug or am I missing something?

-- 
mcz
Received on Mon Jan 15 2018 - 00:18:59 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC