aboutsummaryrefslogtreecommitdiff
path: root/src/rc
AgeCommit message (Collapse)Author
2017-06-08kill_all: include limits.h for PATH_MAXJory A. Pratt
2017-06-08fix compile issue for muslWilliam Hubbs
2017-06-05openrc-shutdown: add --single option and clean up option processingWilliam Hubbs
2017-06-04add support for writing reboot and shutdown records to wtmpWilliam Hubbs
2017-05-30openrc-init: fix buffer overflow in init.ctlSergei Trofimovich
How to reproduce 1-byte overflow: ``` $ FEATURES=-test CFLAGS="-fsanitize=address -O0 -ggdb3" emerge -1 openrc ================================================================= ==1==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff0efd8710 at pc 0x000000402076 bp 0x7fff0efd7d50 sp 0x7fff0efd7d40 WRITE of size 1 at 0x7fff0efd8710 thread T0 #0 0x402075 (/sbin/openrc-init+0x402075) #1 0x3cf6e2070f in __libc_start_main (/lib64/libc.so.6+0x3cf6e2070f) #2 0x4013b8 (/sbin/openrc-init+0x4013b8) Address 0x7fff0efd8710 is located in stack of thread T0 at offset 2432 in frame #0 0x401cfb (/sbin/openrc-init+0x401cfb) This frame has 3 object(s): [32, 160) 'signals' [192, 344) 'sa' [384, 2432) 'buf' <== Memory access at offset 2432 overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow ??:0 ?? ``` The problem here is in the code handling reads from 'init.ctl': ``` int main(int argc, char **argv) { ... char buf[2048]; for (;;) { /* This will block until a command is sent down the pipe... */ fifo = fopen(RC_INIT_FIFO, "r"); count = fread(buf, 1, 2048, fifo); buf[count] = 0; ... } ``` `buf[count] = 0;` writes outside the buffer when `fread()` returns non-truncated read. This fixes #138.
2017-05-30rc-logger.c: fix crash on fclose(NULL) (#137)Sergei Trofimovich
Only close the log if we successfully opened it. Reported-by: Brian Evans <grknight@gentoo.org> Tested-by: Brian Evans <grknight@gentoo.org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-05-22openrc-shutdown: add dry-run optionWilliam Hubbs
2017-05-22openrc-shutdown: move to single user mode by defaultWilliam Hubbs
To be more compatible with sysvinit, move to single user mode if no options are specified on the command line.
2017-05-22init: add ability to switch to single user modeWilliam Hubbs
2017-05-19add kill_all helperWilliam Hubbs
This is similar to the sysvinit killall5 utility. It should only be used in service scripts, so it will not be installed in the path. This closes #129.
2017-05-15rc_status: calculate time differences in time_t and display seconds in uptimeWilliam Hubbs
2017-05-12supervise-daemon: save start time and respawn count before dropping privsWilliam Hubbs
2017-05-11rc-status: show uptimes and respawn counts for supervised daemonsWilliam Hubbs
2017-05-11fix to_time_t to honor dstWilliam Hubbs
2017-05-11fix from_time_t functionWilliam Hubbs
2017-05-11Move time_t conversions to rc-misc.c so they can be sharedWilliam Hubbs
2017-05-11supervise-daemon: save start time and respawn countWilliam Hubbs
This will allow rc-status to display an uptime and restart count for supervised processes.
2017-05-11supervise-daemon: fix our status when we give up on the child processWilliam Hubbs
2017-05-10supervise-daemon:create multiple options from --respawn-limitWilliam Hubbs
This creates --respawn-delay, --respawn-max and --respawn-period. It was suggested that it would be easier to follow if the options were separated. This is for #126.
2017-05-09supervise-daemon: add a --respawn-limit optionWilliam Hubbs
Allow limiting the number of times supervise-daemon will attempt to respawn a daemon once it has died to prevent infinite respawning. Also, set a reasonable default limit (10 times in a 5 second period). This is for issue #126.
2017-04-29supervise-daemon: mark all open file descriptors FD_CLOEXECWilliam Hubbs
2017-04-29supervise-daemon:remove the controlling tty in the supervisorWilliam Hubbs
2017-04-29supervise-daemon: fix access to tty_fd and devnull_fdWilliam Hubbs
Both the child and supervisor need access to these file descriptors.
2017-04-29supervise-daemon: mark the service started when the supervisor is activeWilliam Hubbs
2017-04-17init: send term/kill signals as final step of shutdownWilliam Hubbs
2017-04-13init: fix signal handlingWilliam Hubbs
The only signals we handle are SIGINT and SIGCHLD, so block all others and unblock them in the child process before we start a rurnlevel.
2017-04-12init: add re-exec capabilityWilliam Hubbs
This will allow the re-execution of the init process after upgrading OpenRC.
2017-04-07Add attribution to openrc-init.c and openrc-shutdown.cWilliam Hubbs
2017-04-06add init processWilliam Hubbs
openrc-init.c and openrc-shutdown.c are based on code which was written by James Hammons <jlhamm@acm.org>, so I would like to publically thank him for his work.
2017-04-03start-stop-daemon: warn if calling --start with --retry or --stop with --waitAustin English
This fixes #122
2017-01-25start-stop-daemon: allow all standard signalsDoug Freed
Also we define the signalpair_item macro. This fixes #113. X-Gentoo-Bug: 604986 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604986
2017-01-04mountinfo: make the path to /proc/mounts a constantWilliam Hubbs
This path should not be hard coded in the open call. Linux prior to 2.4.19 did not have /proc/self/mounts, so for now I'm making this value /proc/mounts everywhere, but that may change to /proc/self/mounts on linux; I'm not sure we should care about <2.4.19. X-Gentoo-Bug: 604646 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604646
2017-01-04Clean up warnings that can use the _unused macroBenda Xu
X-Gentoo-Bug: 604666 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604666
2017-01-04Indentation fixesBenda Xu
X-Gentoo-Bug: 604666 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604666
2016-11-17selinux: fix SIGSEGV with invalid contextsJason Zaman
Fixes: https://github.com/openrc/openrc/issues/104
2016-11-01src/rc/rc: do not try to start services if fork failsWilliam Hubbs
2016-10-24src/rc/rc-misc.c: report error if call to flock() failsWilliam Hubbs
X-Gentoo-Bug: 597390 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=597390
2016-10-11do_service: Initialize idx to 0Sven Wegener
If index is not explicitly specified for service_started_daemon, it will look for daemons by random index. This fixes #100.
2016-09-30openrc-run: fix double freeDoug Freed
2016-09-19Revert "Disable parallel startup in interactive mode"William Hubbs
This reverts commit 8b4fc05ff2645b2ecb0f153492f72dd8b39ba431. The original commit did not explain why this feature was disabled, and I now have a request to enable it. This fixes #24.
2016-09-16rc-misc: allow EINFO_VERBOSE through tooDoug Freed
2016-09-14rc-misc: Allow EINFO_COLOR through env_filter()Doug Freed
This allows rc-service -C <service> <action> to properly not print color messages. Fixes #93
2016-08-25openrc-run: make runscript warning respect quiet optionWilliam Hubbs
X-Gentoo-Bug: 591414 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=591414
2016-07-26start-stop-daemon: Add SSD_IONICELEVELKenneth Lakin
This is the disk IO counterpart to SSD_NICELEVEL. Modified by William Hubbs to add the variable to the start-stop-daemon man page. This fixes #69.
2016-07-24rc-logger: refuse to cat TMPLOG into itselfDoug Freed
This prevents an infinite loop in case somebody decides to set rc_log_path to match TMPLOG.
2016-07-18rc-status: add -m/--manual option to show manually started servicesWilliam Hubbs
X-Gentoo-Bug: 585906 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=585906
2016-07-16rc: Rename some static variables to kill warningsDoug Freed
2016-07-14Remove the DEBUG_MEMORY macroWilliam Hubbs
This fixes #43.
2016-07-14make variable aflag a boolean show_allWilliam Hubbs
2016-06-10fstabinfo/mountinfo: ensure /etc/fstab exists before calling setmntentWilliam Hubbs
This is based on a patch by A. Wilcox <awilfox.gentoo@foxkit.us>. X-Gentoo-Bug: 478226 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478226 X-Gentoo-Bug: 478226 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478226