aboutsummaryrefslogtreecommitdiff
path: root/src/librc
AgeCommit message (Collapse)Author
2022-04-06migrate fully to meson build systemWilliam Hubbs
- drop old build system - move shared include and source files to common directory - drop "rc-" prefix from shared include and source files - move executable-specific code to individual directories under src - adjust top-level .gitignore file for new build system This closes #489.
2021-12-30fix libkvm dependency for *bsdWilliam Hubbs
2021-12-21code style: remove space after unary "not" operatorMatt Whitlock
There are no semantic changes in this commit. Suggested-by: Mike Frysinger <vapier@gentoo.org> See: https://github.com/OpenRC/openrc/pull/435#pullrequestreview-727035394
2021-12-20use HEAD in git URIs to point to the default branchMike Frysinger
This makes the URIs shorter and dynamic: whatever the default branch the repo uses will be used.
2021-12-20drop unused copyright variablesMike Frysinger
The existing copyright notices in the file headers cover these vars.
2021-11-12src/librc/librc-daemon.c: add missing include for kill (fix uclibc)Sam James
Fixes: #471 Fixes: #473
2021-11-12src/librc/librc-misc.c: add missing include for fileno (fix uclibc)Sam James
Fixes: #471 Fixes: #473
2021-09-06build: change root_prefix to rootprefixWilliam Hubbs
2021-09-04add meson build filesWilliam Hubbs
Closes #116. Closes #171. Closes #172. Closes #175.
2021-08-13librc: fix rc_runlevel_exists return for empty stringWilliam Hubbs
This function should return false if the runlevel is an empty string. X-Gentoo-Bug: 803536 X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536 Closes: https://github.com/OpenRC/openrc/pull/431
2021-03-22stop namespaced services with specified pidsWilliam Hubbs
The previous fix excludes PIDs of processes running in a different namespace regardless of whether the PID has been explicitly stored in a PID file mentioned in the --pidfile parameter. The correct behavior is to only exclude the pid if it is not stored in a pidfile. X-Gentoo-Bug: 776010 X-Gentoo-Bug-URL: https://bugs.gentoo.org/776010
2019-07-24Fix build with ClangMartin Wilke
This fixes #313.
2019-02-26remove hidden-visibility.hWilliam Hubbs
I am removing this on the advice of a member of the Gentoo toolchain team. It was explained to me that this doesn't offer any significant benefits to OpenRC. If anyone ffeels differently, please open a pull request reverting this and adding an explanation of what it does and how to know which functions to mark hidden in the future. This fixes #301.
2019-02-23librc: fix potential buffer overflow in pid_is_argvWilliam Hubbs
This fixes #299.
2019-02-23Revert "src/librc/librc-daemon.c: fix buffer overrun in pid_is_argv"William Hubbs
This reverts commit 084877eb52971faf8f52c780ddd08ed9af140eb6. The mentioned commit caused some systems to have some services reported as crashed. This fixes #297. This fixes #298.
2019-02-21librc/librc-depend.c: fix NULL pointer dereferenceGeorgy Yakovlev
In some cases deptree or depinfo can be NULL, check before dereferencing. Fixes https://github.com/OpenRC/openrc/issues/293 Fixes https://github.com/OpenRC/openrc/pulls/294 X-Gentoo-Bug: 659906 X-Gentoo-Bug-URL: https://bugs.gentoo.org/659906
2019-02-12librc: fix realpath() return value checkEdan Bedrik
This fixes #226.
2018-12-27fix leading whitespacephilhofer
Clean up code indented with mixed tabs and spaces. No actual code changes. This fixes #280.
2018-12-27fix potential out-of-bounds readsphilhofer
readlink(3) does not nul-terminate the result it sticks into the supplied buffer. Consequently, the code rc = readlink(path, buf, sizeof(buf)); does not necessarily produce a C string. The code in rc_find_pid() produces some C strings this way and passes them to strlen() and strcmp(), which can lead to an out-of-bounds read. In this case, since the code already takes care to zero-initialize the buffers before passing them to readlink(3), only allow sizeof(buf)-1 bytes to be returned. (While fixing this issue, I fixed two other locations that used the same problematic pattern.) This fixes #270.
2018-12-24src/librc/librc-daemon.c: fix buffer overrun in pid_is_argvphilhofer
The contents of /proc/<pid>/cmdline are read into a stack buffer using bytes = read(fd, buffer, sizeof(buffer)); followed by appending a null terminator to the buffer with buffer[bytes] = '\0'; If bytes == sizeof(buffer), then this write is out-of-bounds. Refactor the code to use rc_getfile instead, since PATH_MAX is not the maximum size of /proc/<pid>/cmdline. (I hit this issue in practice while compiling Linux; it tripped the stack-smashing protector.) This is roughly the same buffer overflow condition that was fixed by commit 0ddee9b7d2b8dea810e252ca6a95c457876df120 This fixes #269.
2018-12-21fix compiler warningsWilliam Hubbs
2018-08-06librc: fix EACCES errno false-positive crashZac Medico
Use errno != EACCES to fix false-positive for non-root users with grsecurity kernels. Fixes: 37e29442721a ("librc: Add check for crashed state") This fixes #237
2018-06-27librc-daemon.c: fix memory leaksWilliam Hubbs
2018-06-22librc-daemon: convert most snprintf calls to xasprintfWilliam Hubbs
2018-06-20librc-misc: convert snprintf calls to xasprintfWilliam Hubbs
2018-05-22librc: Add check for crashed stateWilliam Hubbs
In rc_service_state,, call rc_service_daemons_crashed to check for a crashed daemon if the service is started.
2018-05-22librc: Add crashed stateWilliam Hubbs
2017-11-30Fix repeated dependency cache rebuild if clock skewedWill Miles
rc_deptree_update_needed would return early as soon as it found any file newer than the existing dependency cache. Unfortunately, the first file found may not be the newest one there; so the clock skew workaround in rc-misc:_rc_deptree_load would be given a timestamp that was still too old. This fix forces a full scan of all relevant files, so as to ensure that we return a timestamp that will allow the clock skew fix to operate. The runtime cost is no worse than the case where the cache is up to date (ie. we must check every possible file). This fixes #161.
2017-11-13rc_find_pids: namespace fixWilliam Hubbs
Ignore namespaces if there are errors reading either the pid namespace for the current process or the process we aare testing. This fixes https://github.com/openrc/openrc/issues/180.
2017-10-26rc_service_value_set: remove the option if NULL is the valueWilliam Hubbs
This allows the equivalent of "unsetting" a value for a service.
2017-10-24rc_find_pids: ignore pids that are not in our pid namespaceWilliam Hubbs
X-Gentoo-Bug: 634634 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=634634
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-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
2016-12-19librc: detect loops in stacked runlevels and abortDoug Freed
This fixes #109. X-Gentoo-Bug: 558700 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=558700
2016-07-31librc: fix Docker auto detectionWilliam Hubbs
The original auto detection of Docker containers assumed the presence of a container environment variable. However, Docker-1.12 does not implement this, and I'm not sure which versions of docker implemented it. The new test is for the presence of a file named .dockerenv in the root directory.
2016-07-14Remove the DEBUG_MEMORY macroWilliam Hubbs
This fixes #43.
2016-01-21librc: Complain when a real and virtual service have the same nameWilliam Hubbs
2016-01-19librc: handle rc_sys="prefix" even if we weren't built with a prefixDoug Freed
This probably isn't needed, but it mimics old behavior.
2016-01-19librc: fix handling the nothing special case for rc_sysDoug Freed
2016-01-19librc: move system detection code into rc_sys and use itDoug Freed
This fixes an issue where librc code was calling code that only existed in the rc binary. This reverts commits 8addd79 and 9f6e056 This fixes #75.
2016-01-18Revert "librc: fix librc-depend functions to call rc_sys"William Hubbs
This reverts commit 73482cf13a338051606788957cbd0031ac850c70.
2016-01-18librc: fix librc-depend functions to call rc_sysWilliam Hubbs
2015-12-21Convert OpenRC to a centralized copyright/license structureWilliam Hubbs
In the past, OpenRC was a hybrid of a centralized and file-scope license/copyright structure. I followed the instructions from the Software Freedom Law Center [1] to convert to a Centralized structure where possible, for easier future maintenance. [1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
2015-12-08rc.map: remove references to rc_sys_v{1,2}William Hubbs
2015-12-08Convert rc_sys() calls to detect_container() and detect_vm()William Hubbs
2015-12-02Add detection for rkt containersWilliam Hubbs
2015-12-02Add detection for docker containersWilliam Hubbs
2015-12-01librc: comsolidate rc_sys_v1 and rc_sys_v2 into rc_sysWilliam Hubbs
These functions were never meant to be used outside of OpenRC, and they were added when we thought we were going to do away with the automatic detection of subsystems. Since the autodetection is not going away, we can combine these functions into rc_sys.
2015-11-12Implement "want" dependencyIan Stakenvicius
The want dependency is similar to the use dependency. If a service script, for example called service1, adds "want service2" to its depend function, OpenRC will attempt to start service2, if it exists on the system, when service1 is started. However, service1 will start regardless of the status of service2. X-Gentoo-Bug: 406021 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=406021
2015-11-11Standardize macro tests for gnu hurdBenda Xu
This also fixes breakage of GNU/hurd builds introduced by commit 3f82edbeb92.