Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 659906 - sys-apps/openrc-0.38.1 - “rc-status” terminated by signal SIGSEGV (Address boundary error)
Summary: sys-apps/openrc-0.38.1 - “rc-status” terminated by signal SIGSEGV (Address bo...
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-03 03:22 UTC by Georgy Yakovlev
Modified: 2019-02-22 00:03 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georgy Yakovlev gentoo-dev 2018-07-03 03:22:56 UTC
if I run rc-status as user, it exits with Segmentation fault

here is what happening

close(3)                                = 0
stat("/run/openrc/started/sysstat", {st_mode=S_IFREG|0755, st_size=380, ...}) = 0
stat("/run/openrc/stopped/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/starting/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/stopping/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/inactive/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/wasinactive/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/hotplugged/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/failed/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/scheduled/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
stat("/run/openrc/crashed/sysstat", 0x7ffcfcd3e5a0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/openrc/daemons/sysstat", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
Segmentation fault


Core was generated by `rc-status'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000767a9ab98f95 in get_depinfo (deptree=0x0, service=0x5ce430770ff0 "ntpd") at librc-depend.c:88
88              TAILQ_FOREACH(di, deptree, entries)

Thread 1 (LWP 102044):
#0  0x0000767a9ab98f95 in get_depinfo (deptree=0x0, service=0x5ce430770ff0 "ntpd") at librc-depend.c:88
        di = 0x0
#1  0x0000767a9ab9a0fc in __RC_rc_deptree_depends (deptree=0x0, types=0x5ce43077e100, services=0x5ce43077dba0, runlevel=0x5ce4307704f0 "sysinit", options=1) at librc-depend.c:476
        sorted = 0x5ce43077e120
        visited = 0x5ce430771110
        di = 0x767a9afc9110
        service = 0x5ce43077e880
#2  0x00005ce42fa3b02a in main (argc=1, argv=0x7fffa3637b68) at rc-status.c:394
        s = 0x5ce430770fd0
        l = 0x5ce43077e880
        t = 0x5ce430771010
        level = 0x5ce4307704d0
        show_all = false
        p = 0x5ce43077e860 ""
        runlevel = 0x5ce4307704b0 "sysinit"
        opt = 1
        retval = 0


Reproducible: Always

Steps to Reproduce:
1. run rc-service as user
Actual Results:  
“rc-status” terminated by signal SIGSEGV (Address boundary error)

Expected Results:  
shows status

Portage 2.3.41 (python 3.6.5-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-7.3.0, glibc-2.27-r5, 4.16.18-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.16.18-gentoo-x86_64-AMD_Ryzen_Threadripper_1950X_16-Core_Processor-with-gentoo-2.6
KiB Mem:    64809384 total,  59138872 free
KiB Swap:   16777208 total,  16777208 free
Timestamp of repository gentoo: Mon, 02 Jul 2018 22:46:12 +0000
Head commit of repository gentoo: 293104e379ecb2849b8d21d9a0c85b8d2342bb09

Timestamp of repository rust: Wed, 13 Jun 2018 08:55:06 +0000
Head commit of repository rust: 1f8d18e7ac7ad6f76c0706d54a7a90fd00912016

Head commit of repository steam-overlay: 1237b523da636a247376b25cd4ec59c16d5b0104

sh bash 4.4_p23
ld GNU ld (Gentoo 2.30 p3) 2.30.0
distcc[103343] (dcc_mkdir) ERROR: mkdir '/tmp/portage/.distcc/state' failed: No such file or directory [disabled]
app-shells/bash:          4.4_p23::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5-r1::gentoo
dev-util/cmake:           3.11.4::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6::gentoo
sys-apps/openrc:          0.38.1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.30-r3::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.16-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r5::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    sync-git-clone-extra-opts: -b master
    sync-git-verify-commit-signature: true

gyakovlev
    location: /var/db/repos/gyakovlev
    masters: gentoo

rust
    location: /var/db/repos/rust
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/rust.git
    masters: gentoo

steam-overlay
    location: /var/db/repos/steam
    sync-type: git
    sync-uri: https://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -frecord-gcc-switches"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -frecord-gcc-switches"
DISTDIR="/var/cache/portage/distfiles"
EMERGE_DEFAULT_OPTS="--ask-enter-invalid --jobs=32  --load-average 32"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -O2 -pipe -frecord-gcc-switches"
FEATURES="assume-digests binpkg-logs buildpkg cgroup collision-protect compressdebug config-protect-if-modified distlocks downgrade-backup ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms sign splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe -frecord-gcc-switches"
GENTOO_MIRRORS="https://gentoo.osuosl.org/ http://gentoo.mirrors.pair.com/ http://cosmos.illinois.edu/pub/gentoo/ http://lug.mtu.edu/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0"
LINGUAS="en"
MAKEOPTS="-j32 -l32"
PKGDIR="/var/cache/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
USE="X a52 aac acl acpi activities alsa amd64 bash-completion berkdb bluray branding bzip2 cairo cdda cdr cli crypt cups cxx dbus declarative djvu dri dts dvd dvdr elogind emboss encode epub exif fam fbcon flac fontconfig fortran gdbm gif glamor gpm gtk iconv ios ipv6 jit jpeg kde kipi kwallet lcms libnotify libtirpc lm_sensors lz4 lzma lzo mad mng mobi module-sign modules mp3 mp4 mpeg multilib ncurses nls nptl numa ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qml qt5 readline seccomp semantic-desktop smp spell ssl startup-notification svg tiff truetype udev udisks unicode upower urandom usb vaapi vdpau vim-syntax vorbis wayland widgets x264 xattr xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="32 64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon plan sheets stage words" CAMERAS="ptp2 fuji" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu radeon radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

sys-apps/openrc-0.38.1::gentoo was built with the following:
USE="debug ncurses netifrc pam unicode -audit -newnet (-prefix) (-selinux) -static-libs" ABI_X86="(64)"
CFLAGS="-O0 -ggdb -pipe"
Comment 1 Georgy Yakovlev gentoo-dev 2018-07-03 07:06:26 UTC
overall rc-status seems to fail to read some entries in /run/openrc

/run/openrc/{depconfig,deptree,softlevel} can only be read as root.

that results in another, possibly related issue

$ rc-status -r
sysinit
...
openat(AT_FDCWD, "/run/openrc/softlevel", O_RDONLY) = -1 EACCES (Permission denied)
...


while as root it's as expected

# rc-status -r
default
Comment 2 William Hubbs gentoo-dev 2018-07-09 18:49:55 UTC
I'm not sure how you ended up with things in /run/openrc not being world
readable. You can fix this by running this command as root:

# chmod --recursive go+r /run/openrc

Below you will find the output I get if I run the mentioned commands:

-- cut here ---

william@linux1 ~ $ rc-status -r
default
william@linux1 ~ $ rc-status
Runlevel: default
 metalog                                                           [  started  ]
 dhcpcd                                                            [  started  ]
 ddclient                                                          [  started  ]
 cronie                                                            [  started  ]
 bitlbee                                                           [  started  ]
 chronyd                                                           [  started  ]
 espeakup                                                          [  stopped  ]
 nullmailer                                                        [  started  ]
 sshd                                                              [  started  ]
 local                                                             [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual

--- cut here ---
Comment 3 William Hubbs gentoo-dev 2018-07-12 22:37:08 UTC
That being said, I will keep this open because I need to look into why
the error handling for this scenario is not good.
Comment 4 Georgy Yakovlev gentoo-dev 2018-07-12 23:45:59 UTC
I'm pretty sure I did not do anything that could influence the permissions of openrc files in /run directory, I just let openrc mount it and not touching umask and there is no /run entry in fstab as well.

my openrc box is non-operational now, but I'll try to spin it up or spin up a vm with minimal configuration possible and check permissions.

generally yes, some checks seem to be missing/misbehaving while loading deptree or softlevel from /run. It should definitely fail or do something else if it can't read the files and deptree is empty.
Comment 5 William Hubbs gentoo-dev 2019-02-22 00:03:57 UTC
This is fixed in the following commit:


https://github.com/openrc/openrc/commit/7478c104
oThis will be in openrc-0.41.