s6-rc-init segmentation fault with existing, empty live dir

From: Patrick Mahoney <pat_at_polycrystal.org>
Date: Sat, 02 Apr 2016 11:48:34 -0500

Given an empty src dir, and a dest dir created by `s6-rc-compile dest
src` (so it has service dirs for only s6rc-fdholder and
s6rc-oneshot-runner):

     $ mkdir scandir # same error with or without s6-svscan running
     $ mkdir live
     $ s6-rc-init -c $PWD/dest -l $PWD/live $PWD/scandir
     Segmentation fault (core dumped)

s6-rc 0.0.2.1
skalibs 2.3.9.0

strace output:

     execve("/home/pat/.nix-profile/bin/s6-rc-init", ["s6-rc-init", "-c",
"/home/pat/scratch/s6/dest", "-l", "/home/pat/scratch/s6/live",
"/home/pat/scratch/s6/scandir"], [/* 76 vars */]) = 0
     brk(0) = 0x1778000
     mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7f5e0c626000
     access("/etc/ld-nix.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
     
open("/nix/store/fa2zmayc2hz5025s8bbz8szijg1akrr3-glibc-2.23/lib/tls/x86_64/libc.so.6",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
     
stat("/nix/store/fa2zmayc2hz5025s8bbz8szijg1akrr3-glibc-2.23/lib/tls/x86_64",
0x7ffe27b3a3b0) = -1 ENOENT (No such file or directory)
     
open("/nix/store/fa2zmayc2hz5025s8bbz8szijg1akrr3-glibc-2.23/lib/tls/libc.so.6",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
     
stat("/nix/store/fa2zmayc2hz5025s8bbz8szijg1akrr3-glibc-2.23/lib/tls",
0x7ffe27b3a3b0) = -1 ENOENT (No such file or directory)
     
open("/nix/store/fa2zmayc2hz5025s8bbz8szijg1akrr3-glibc-2.23/lib/x86_64/libc.so.6",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
     
stat("/nix/store/fa2zmayc2hz5025s8bbz8szijg1akrr3-glibc-2.23/lib/x86_64",
0x7ffe27b3a3b0) = -1 ENOENT (No such file or directory)
     
open("/nix/store/fa2zmayc2hz5025s8bbz8szijg1akrr3-glibc-2.23/lib/libc.so.6",
O_RDONLY|O_CLOEXEC) = 3
     read(3,
"\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\t\2\0\0\0\0\0"...,
832) = 832
     fstat(3, {st_mode=S_IFREG|0555, st_size=1905592, ...}) = 0
     mmap(NULL, 3791328, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE,
3, 0) = 0x7f5e0c068000
     mprotect(0x7f5e0c1fc000, 2097152, PROT_NONE) = 0
     mmap(0x7f5e0c3fc000, 24576, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x194000) = 0x7f5e0c3fc000
     mmap(0x7f5e0c402000, 14816, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5e0c402000
     close(3) = 0
     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7f5e0c625000
     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7f5e0c624000
     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7f5e0c623000
     arch_prctl(ARCH_SET_FS, 0x7f5e0c624700) = 0
     mprotect(0x7f5e0c3fc000, 16384, PROT_READ) = 0
     mprotect(0x7f5e0c628000, 4096, PROT_READ) = 0
     gettimeofday({1459615447, 897131}, NULL) = 0
     brk(0) = 0x1778000
     brk(0x1799000) = 0x1799000
     unlink("/home/pat/scratch/s6/live") = -1 EISDIR (Is a directory)
     unlink("/home/pat/scratch/s6/live:initial") = -1 ENOENT (No such
file or directory)
     mkdir("/home/pat/scratch/s6/live:initial", 0755) = 0
     open("/home/pat/scratch/s6/live:initial/lock",
O_WRONLY|O_CREAT|O_NONBLOCK, 0666) = 3
     flock(3, LOCK_EX) = 0
     symlink("live:initial", "/home/pat/scratch/s6/live") = -1 EEXIST
(File exists)
     unlink("/home/pat/scratch/s6/live") = -1 EISDIR (Is a directory)
     unlink("/home/pat/scratch/s6/live:initial") = -1 EISDIR (Is a
directory)
     open("/home/pat/scratch/s6/live:initial",
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
     fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
     getdents(4, /* 3 entries */, 32768) = 72
     getdents(4, /* 0 entries */, 32768) = 0
     close(4) = 0
     unlink("/home/pat/scratch/s6/live:initial/lock") = 0
     rmdir("/home/pat/scratch/s6/live:initial") = 0
     --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1d}
---
     +++ killed by SIGSEGV (core dumped) +++
     Segmentation fault (core dumped)
-- 
Patrick Mahoney <pat_at_polycrystal.org>
Received on Sat Apr 02 2016 - 16:48:34 UTC

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