summaryrefslogtreecommitdiff
path: root/src/core/execute.c
Commit message (Collapse)AuthorAge
* core: don't wait for reply if writing to pipe failsZbigniew Jędrzejewski-Szmek2015-03-13
| | | | | | | This shouldn't really happen, but it's seems cleaner to continue on error. CID #1237552.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* core: make RuntimeDirectory honor SELinux labelsZbigniew Jędrzejewski-Szmek2015-02-14
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1192726
* include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen2015-02-12
| | | | | | include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
* exec: also evaluate working_directory_missing_ok when not applying chrootsLennart Poettering2015-02-12
|
* core: don't fail to run services in --user instances if $HOME is missingLennart Poettering2015-02-12
| | | | | | | | Otherwise we cannot even invoke systemd-exit.service anymore, thus not even exit. https://bugs.freedesktop.org/show_bug.cgi?id=83100 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759320
* core: remove unneeded <libgen.h> includeCristian Rodríguez2015-02-11
| | | | execute.c only uses basename (the GNU version in <string.h>)
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* core: Fix EACCES check for OOM adjustmentsMartin Pitt2015-01-13
| | | | Commit 3bd5c3 added a check for EACCES, but missed the minus sign.
* core: modernize execution code a bitLennart Poettering2015-01-09
| | | | | | | | | | | | Among other things, avoid log_struct() unless we really need it. Also, use "r" as variable to store function errors in, instead of "err". "r" is pretty much what we use everywhere else, hence using the same here make sense. FInally, in the child, when we want to log, make sure to open the logging framework first, since it is explicitly closed in preparation for the exec().
* core: check both EPERM and EACCES for OOM adjustmentsLennart Poettering2015-01-08
|
* core: make EPERM errors when applying OOM adjustment for forked processes ↵Lennart Poettering2015-01-08
| | | | | | non-fatal This should be useful for user namespaces.
* tree-wide: remove unnecessary LOG_PRIZbigniew Jędrzejewski-Szmek2015-01-06
| | | | | LOG_DEBUG is already a log level, there is no need to use LOG_PRI which is for filtering out the facility.
* journal: call connect() with dropped privilegesZbigniew Jędrzejewski-Szmek2015-01-05
| | | | | | | | | | | When systemd starts a service, it first opened /run/systemd/journal/stdout socket, and only later switched to the right user.group (if they are specified). Later on, journald looked at the credentials, and saw root.root, because credentials are stored at the time the socket is opened. As a result, all messages passed over _TRANSPORT=stdout were logged with _UID=0, _GID=0. Drop real uid and gid temporarily to fix the issue.
* env-util: don't include files from src/core/Lennart Poettering2014-12-23
|
* core: rearrange code so that libsystemd/sd-bus/ does not include header ↵Lennart Poettering2014-12-23
| | | | | | | files from core Stuff in src/shared or src/libsystemd should *never* include code from src/core or any of the tools, so don't do that here either. It's not OK!
* execute: the runtime directory can only be on tmpfs, hence don't use ↵Lennart Poettering2014-12-19
| | | | rm_rf_dangerous() needlessly
* core: make exec_command_free_list return NULLZbigniew Jędrzejewski-Szmek2014-12-18
|
* core: correct spacing near eol in code commentsTorstein Husebø2014-12-11
|
* scope: make attachment of initial PIDs a bit more robustLennart Poettering2014-12-10
|
* util: introduce our own gperf based capability listLennart Poettering2014-12-10
| | | | | This way, we can ensure we have a more complete, up-to-date list of capabilities around, always.
* selinux: figure out selinux context applied on exec() before closing all fdsMichal Sekletar2014-12-04
| | | | | | We need original socket_fd around otherwise mac_selinux_get_child_mls_label fails with -EINVAL return code. Also don't call setexeccon twice but rather pass context value of SELinuxContext option as an extra argument.
* treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1Lennart Poettering2014-11-28
|
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* core: convert log_unit_*() to log_unit_*_errno()Michal Schmidt2014-11-28
| | | | | | Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_unit_(debug|info|notice|warning|error|emergency)\(([^"]+), "(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_unit_\1_errno(\2, \5, "\3%m"\4);/'
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* log: fix order of log_unit_struct() to match other logging callsLennart Poettering2014-11-28
| | | | | Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
* log: rearrange log function namingLennart Poettering2014-11-27
| | | | | | | | | | - Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
* smack: introduce new SmackProcessLabel optionWaLyong Cho2014-11-24
| | | | | | | | | | | | | | | | | In service file, if the file has some of special SMACK label in ExecStart= and systemd has no permission for the special SMACK label then permission error will occurred. To resolve this, systemd should be able to set its SMACK label to something accessible of ExecStart=. So introduce new SmackProcessLabel. If label is specified with SmackProcessLabel= then the child systemd will set its label to that. To successfully execute the ExecStart=, accessible label should be specified with SmackProcessLabel=. Additionally, by SMACK policy, if the file in ExecStart= has no SMACK64EXEC then the executed process will have given label by SmackProcessLabel=. But if the file has SMACK64EXEC then the SMACK64EXEC label will be overridden. [zj: reword man page]
* core: introduce new Delegate=yes/no property controlling creation of cgroup ↵Lennart Poettering2014-11-05
| | | | | | | | | | | | | | | | | | | | | | | | subhierarchies For priviliged units this resource control property ensures that the processes have all controllers systemd manages enabled. For unpriviliged services (those with User= set) this ensures that access rights to the service cgroup is granted to the user in question, to create further subgroups. Note that this only applies to the name=systemd hierarchy though, as access to other controllers is not safe for unpriviliged processes. Delegate=yes should be set for container scopes where a systemd instance inside the container shall manage the hierarchies below its own cgroup and have access to all controllers. Delegate=yes should also be set for user@.service, so that systemd --user can run, controlling its own cgroup tree. This commit changes machined, systemd-nspawn@.service and user@.service to set this boolean, in order to ensure that container management will just work, and the user systemd instance can run fine.
* mac: also rename use_{smack,selinux,apparmor}() calls so that they share the ↵Lennart Poettering2014-10-23
| | | | new mac_{smack,selinux,apparmor}_xyz() convention
* mac: rename apis with mac_{selinux/smack}_ prefixWaLyong Cho2014-10-23
|
* environment: append unit_id to error messages regarding EnvironmentFileLukas Nykryn2014-10-17
|
* execute: downgrade namespace error to "warning"Lennart Poettering2014-10-17
| | | | | Also, extend the printed warning a bit, explaining the situation more verbosely.
* execute: don't fail child when we don't have privileges to setup namespacesMichal Sekletar2014-10-17
| | | | | | | If we don't have privileges to setup the namespaces then we are most likely running inside some sort of unprivileged container, hence not being able to create namespace is not a problem because spawned service can't access host system anyway.
* Report aa_change_onexec error codeMichael Scherer2014-10-11
| | | | | | | Since aa_change_onexec return the error code in errno, and return -1, the current code do not give any useful information when something fail. This make apparmor easier to debug, as seen on https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760526
* core: execute - don't leak strvTom Gundersen2014-09-30
|
* swap: introduce Discard propertyJan Synacek2014-09-29
| | | | Process possible "discard" values from /etc/fstab.
* socket: introduce SELinuxContextFromNet optionMichal Sekletar2014-09-19
| | | | | | | | | | This makes possible to spawn service instances triggered by socket with MLS/MCS SELinux labels which are created based on information provided by connected peer. Implementation of label_get_child_mls_label derived from xinetd. Reviewed-by: Paul Moore <pmoore@redhat.com>
* execute: silence warningsThomas Hindoe Paaboel Andersen2014-09-08
| | | | Mark two function parameters as const
* service: hook up custom endpoint logicDaniel Mack2014-09-08
| | | | | | | | | | | | If BusPolicy= was passed, the parser function will have created an ExecContext->bus_endpoint object, along with policy information. In that case, create a kdbus endpoint, and pass its path name to the namespace logic, to it will be mounted over the actual 'bus' node. At endpoint creation time, no policy is updloaded. That is done after fork(), through a separate call. This is necessary because we don't know the real uid of the process earlier than that.
* namespace: add support for custom kdbus endpointDaniel Mack2014-09-08
| | | | | | | | | | If a path to a previously created custom kdbus endpoint is passed in, bind-mount a new devtmpfs that contains a 'bus' node, which in turn in bind-mounted with the custom endpoint. This tmpfs then mounted over the kdbus subtree that refers to the current bus. This way, we can fake the bus node in order to lock down services with a kdbus custom endpoint policy.
* bus: add kdbus endpoint typesDaniel Mack2014-09-08
| | | | | Add types to describe endpoints and associated policy entries, and add a BusEndpoint instace to ExecContext.
* exec: move code executed after fork into exec_child()Daniel Mack2014-09-05
| | | | | | This factors out one conditional branch that has grown way too big, and makes the code more readable by using return statements rather than jump labels.
* exec: factor out most function arguments of exec_spawn() to ExecParametersDaniel Mack2014-09-05
| | | | | | | | | | This way, the list of arguments to that function gets more comprehensive, and we can get around passing lots of NULL and 0 arguments from socket.c, swap.c and mount.c. It also allows for splitting up the code in exec_spawn(). While at it, make ExecContext const in execute.c.
* util: make use of newly added reset_signal_mask() call wherever appropriateLennart Poettering2014-08-26
|
* execute: explain in a comment, why close_all_fds() is invoked the second ↵Lennart Poettering2014-08-21
| | | | time differently
* core: unify how we generate the prefix string when dumping unit stateLennart Poettering2014-08-21
|
* Revert "socket: introduce SELinuxLabelViaNet option"Lennart Poettering2014-08-19
| | | | | | This reverts commit cf8bd44339b00330fdbc91041d6731ba8aba9fec. Needs more discussion on the mailing list.