summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)AuthorFilesLines
2015-07-10Merge pull request #548 from vcaputo/fix_path_state_debug_msgDaniel Mack1-1/+1
core: include unit in path state transition debug logging.
2015-07-10core: include unit in path state transition debug logging.Vito Caputo1-1/+1
2015-07-09Reload manager defaults at daemon-reloadThomas Blume1-14/+28
"systemctl daemon-reload" should also update the manager defaults from /etc/systemd/system.conf. For details, see: http://lists.freedesktop.org/archives/systemd-devel/2015-June/033062.html Amended to use manager_set_defaults() as common function.
2015-07-08Merge pull request #500 from zonque/fileioLennart Poettering4-4/+4
fileio: consolidate write_string_file*()
2015-07-06treewide: fix typos of let'sZbigniew Jędrzejewski-Szmek2-3/+3
2015-07-06tree-wide: fix write_string_file() user that should not create filesDaniel Mack1-1/+1
The latest consolidation cleanup of write_string_file() revealed some users of that helper which should have used write_string_file_no_create() in the past but didn't. Basically, all existing users that write to files in /sys and /proc should not expect to write to a file which is not yet existant.
2015-07-06fileio: consolidate write_string_file*()Daniel Mack4-4/+4
Merge write_string_file(), write_string_file_no_create() and write_string_file_atomic() into write_string_file() and provide a flags mask that allows combinations of atomic writing, newline appending and automatic file creation. Change all users accordingly.
2015-07-05core: fix missing bus-util.h includeDavid Herrmann1-0/+1
Whoopsy, forgot to 'git add' this, sorry.
2015-07-05core: don't mount kdbusfs if not wantedDavid Herrmann1-1/+1
Just like we conditionalize loading kdbus.ko, we should conditionalize mounting kdbusfs. Otherwise, we might run with kdbus if it is builtin, even though the user didn't want this.
2015-07-04core: fix coding style in agent-handlingDavid Herrmann1-12/+8
Avoid late bail-out based on a condition. This makes code hard to read. Instead, reverse the forwarding-condition.
2015-07-04core: harden cgroups-agent forwardingDavid Herrmann1-1/+25
On dbus1, we receive systemd1.Agent signals via the private socket, hence it's trusted. However, on kdbus we receive it on the system bus. We must make sure it's sent by UID=0, otherwise unprivileged users can fake it. Furthermore, never forward broadcasts we sent ourself. This might happen on kdbus, as we forward the message on the same bus we received it on, thus ending up in an endless loop.
2015-07-01Merge pull request #459 from ctrochalakis/reuse-port-before-bindDaniel Mack1-6/+1
socket: Set SO_REUSEPORT before bind()
2015-07-01socket: Set SO_REUSEPORT before bind()Christos Trochalakis1-6/+1
bind() fails if it is called before setting SO_REUSEPORT and another process is already binded to the same addess. A new reuse_port option has been introduced to socket_address_listen() to set the option as part of socket initialization.
2015-07-01Revert "kmod-setup: don't print warning on -ENOSYS"David Herrmann1-1/+1
This partially reverts commit 78d298bbc57e412574ea35e6e66f562d97fd9ebc. The changed coding-style is kept, but the ENOENT->ENOSYS conversion is reverted. kmod was fixed upstream to no longer return ENOSYS. Also see: https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=114ec87c85c35a2bd3682f9f891e494127be6fb5 The kmod fix is marked for backport, so no reason to bump the kmod version we depend on.
2015-06-30core: handle --log-target=null when calling systemd-shutdownIago López Galeiras1-0/+4
When shutting down, if systemd was started with --log-target=null, systemd-shutdown was being called with --log-target=console.
2015-06-23core: fix reversed dependency check in unit_check_unneededAbdo Roig-Maranges1-1/+1
This was introduced by commit be7d9ff730cb88d7c6a8 and breaks StopWhenUnneeded=true in the presence of a Requisite dependency.
2015-06-22smack: add default smack process label configWaLyong Cho1-0/+9
Similar to SmackProcessLabel=, if this configuration is set, systemd executes processes with given SMACK label. If unit has SmackProcessLabel=, this config is overwritten. But, do NOT be confused with SMACK64EXEC of execute file. This default execute process label(and also label which is set by SmackProcessLabel=) is set fork-ed process SMACK subject label and used to access the execute file. If the execution file has also SMACK64EXEC, finally executed process has SMACK64EXEC subject. While if the execution file has no SMACK64EXEC, the executed process has label of this config(or label which is set by SmackProcessLabel=). Because if execution file has no SMACK64EXEC then excuted process inherits label from caller process(in this case, the caller is systemd).
2015-06-22smack: support smack access change-ruleWaLyong Cho1-25/+110
Smack is also able to have modification rules of existing rules. In this case, the rule has additional argument to modify previous rule. /sys/fs/smackfs/load2 node can only take three arguments: subject object access. So if modification rules are written to /sys/fs/smackfs/load2, EINVAL error is happen. Those modification rules have to be written to /sys/fs/smackfs/change-rule. To distinguish access with operation of cipso2, split write_rules() for each operation. And, in write access rules, parse the rule and if the rule has four argument then write into /sys/fs/smackfs/change-rule. https://lwn.net/Articles/532340/ fwrite() or fputs() are fancy functions to write byte stream such like regular file. But special files on linux such like proc, sysfs are not stream of bytes. Those special files on linux have to be written with specific size. By this reason, in some of many case, fputs() was failed to write buffer to smack load2 node. The write operation for the smack nodes should be performed with write().
2015-06-17load-fragment: reset the list on an ExecStart= containing only whitespaceFilipe Brandenburger1-5/+3
This is consistent with how an empty string works in an ExecStart= statement. We should not differentiate between an empty string and whitespace only (since they look the same.) Update the test case with whitespace only to reflect that the list is reset. Tested that `test-unit-file` passes and other test cases are not affected. Installed the patched systemd binaries on a machine, booted it, looked for out of the usual behavior but did not find any.
2015-06-17load-fragment: use unquote_first_word in config_parse_execFilipe Brandenburger1-114/+114
Convert config_parse_exec() from using FOREACH_WORD_QUOTED into a loop of unquote_first_word. Loop through the arguments only once (the FOREACH_WORD_QUOTED implementation did it twice, once to count them and another time to process and store them.) Use newly introduced flag UNQUOTE_UNESCAPE_RELAX to preserve unrecognized escape sequences such as regexps matches such as "\w", "\d", etc. (Valid escape sequences such as "\s" or "\b" still need an extra backslash if literals are desired for regexps.) Differences in behavior: - Handle ; (command separator) in special, so that only ; on its own is valid for that purpose, an quoted semicolon ";" or ';' will now behave as a literal semicolon. This is probably what was initially intended. - Handle \; (to introduce a literal semicolon) in special, so that only \; is turned into a semicolon but not \\; or "\\;" or "\;" which are kept as a literal \; in the output. This is probably what was initially intended. Known issues: - Using an empty string (for example, ExecStartPre=<empty>) will empty the list and remove the existing commands, but using whitespace only (for example, ExecStartPre=<spaces>) will not. This is a pre-existing issue and will be dealt with in a follow up commit. Tested: - Unit tests passing. Also `make distcheck` still works as expected. - Installed it on a local machine and booted with it, checked console output, systemctl and journalctl output, did not notice any issues running the patched systemd binaries. Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794
2015-06-17turn kdbus support into a runtime optionKay Sievers6-15/+1
./configure --enable/disable-kdbus can be used to set the default behavior regarding kdbus. If no kdbus kernel support is available, dbus-dameon will be used. With --enable-kdbus, the kernel command line option "kdbus=0" can be used to disable kdbus. With --disable-kdbus, the kernel command line option "kdbus=1" is required to enable kdbus support.
2015-06-17core: execute: fix regression in pam_setup()Daniel Mack1-1/+6
Commit 72c0a2c25 ("everywhere: port everything to sigprocmask_many() and friends") reworked code tree-wide to use the new sigprocmask_many() helper. In this, it caused a regression in pam_setup, because it dropped a line to initialize the 'ss' signal mask which is later used in sigwait(). While at it, move the variable declaration to an inner scope.
2015-06-15everywhere: port everything to sigprocmask_many() and friendsLennart Poettering1-6/+2
This ports a lot of manual code over to sigprocmask_many() and friends. Also, we now consistly check for sigprocmask() failures with assert_se(), since the call cannot realistically fail unless there's a programming error. Also encloses a few sd_event_add_signal() calls with (void) when we ignore the return values for it knowingly.
2015-06-14Merge pull request #189 from teg/rtnl-renameDavid Herrmann1-10/+10
Rename sd_rtnl to sd_netlink to prepare for further netlink-protocol support. Anything rtnl specific still uses the sd_rtnl prefix, but the generic parts (including the bus and message objects) are now called sd_netlink.
2015-06-13sd-netlink: rename from sd-rtnlTom Gundersen1-10/+10
2015-06-12Merge pull request #167 from keszybz/line-oriented-ima-setupkeszybz1-22/+17
ima-setup: write policy one line at a time
2015-06-12selinux: whitespace fixesLennart Poettering1-9/+19
2015-06-12core: fix CID 996302Susant Sahani1-1/+1
CID 996302: Error handling issues (CHECKED_RETURN)
2015-06-11Merge pull request #171 from teg/rtnl-broadcast-2David Herrmann1-1/+1
sd-rtnl: make joining broadcast groups implicit
2015-06-11sd-rtnl: make joining broadcast groups implicitTom Gundersen1-1/+1
2015-06-11kmod-setup: don't print warning on -ENOSYSDaniel Mack1-3/+5
-ENOSYS is returned from kmod_module_probe_insert_module() if a module isn't available, not -ENOENT. Don't spit out a warning in that case unless the warn_if_unavailable flag is set. Also factor out the condition into an own variable for better readability.
2015-06-11ima-setup: write policy one line at a timeZbigniew Jędrzejewski-Szmek1-22/+17
ima_write_policy() expects data to be written as one or more rules, no more than PAGE_SIZE at a time. Easiest way to ensure that we are not splitting rules is to read and write one line at a time. https://bugzilla.redhat.com/show_bug.cgi?id=1226948
2015-06-11kmod-setup: when we fail to load a kmod, log the error causeLennart Poettering1-2/+3
(Also, downgrade message from LOG_ERROR to LOG_WARNING, after all we don't care much and just proceed)
2015-06-11core: Let two more booleans survive a daemon-reloadWerner Fink2-0/+20
Without the boolean bus_name_good services as well as cgroup_realized for units a unit of Type=dbus and ExecReload sending SIGHUP to $MAINPID will be terminated if systemd will be daemon reloaded. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=746151 https://bugs.freedesktop.org/show_bug.cgi?id=78311 https://bugzilla.opensuse.org/show_bug.cgi?id=934077
2015-06-10util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering2-3/+2
It's only marginally shorter then the usual for() loop, but certainly more readable.
2015-06-10Merge pull request #85 from keszybz/selinux-contextZbigniew Jędrzejewski-Szmek1-1/+1
2015-06-10tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering4-12/+14
mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
2015-06-09core: log oom during killing spreeThomas Hindoe Paaboel Andersen1-2/+6
but don't do anything else. We still want to kill as much as possible. Coverity CID#996306
2015-06-09bus-creds: always set SD_BUS_CREDS_PID when we set pid in the maskZbigniew Jędrzejewski-Szmek1-1/+1
Also reorder the code a bit to be easier to parse.
2015-06-08tree-wide: remove spurious spaceThomas Hindoe Paaboel Andersen3-4/+4
2015-06-08kmod-setup: split warn flagsDaniel Mack1-9/+11
Traditionally, we used to warn about ipv6 being a module or being unavailable. This was changed in b4aa82f16 ("kmod-setup: don't warn when ipv6 can't be loaded") in a way that neither of the two conditions will cause a log message. Now, while running a setup without any IPv6 is completely fine and shouldn't cause any warning, we should still warn about ipv6 being a module instead of built-in. To achieve this, split the boolean warn flag into two: one for a feature not being built-in but shipped as a module, and one to print an error when a module is entirely unavailable. We will, however, still warn if kmod returns anything else than -ENOENT in the attempt of loading the module, and at the very least, turn the message into a debug log.
2015-06-05Merge pull request #79 from zonque/fdo-87475Kay Sievers1-1/+1
kmod-setup: don't warn when ipv6 can't be loaded (FDO bug #87475)
2015-06-05kmod-setup: don't warn when ipv6 can't be loadedDaniel Mack1-1/+1
Not having IPv6 is a valid setup. Let's not print a warning in that case. Addresses: https://bugs.freedesktop.org/show_bug.cgi?id=87475
2015-06-05core: Remove "old kernel" warning if PR_SET_CHILD_SUBREAPER failsCristian Rodríguez1-6/+2
This made sense when systemd ran on older kernels, nowdays not so much.
2015-06-04Merge pull request #73 from zonque/mountinfoDavid Herrmann1-0/+3
core/mount: skip incomplete mountinfo entries
2015-06-04core/mount: skip incomplete mountinfo entriesDaniel Mack1-0/+3
Skip /proc/mountinfo entries for which libmount returns a NULL pointer for 'source' or 'target'. This happened on Semaphore CI's build servers when the test suite is run.
2015-06-04Partially revert "ma-setup: simplify"Zbigniew Jędrzejewski-Szmek1-2/+13
copy_bytes() tries to do the write in chunks, but ima kernel code needs every rule to be written in one write. Writing the whole file at once avoids the issue. http://lists.freedesktop.org/archives/systemd-devel/2015-June/032623.html http://sourceforge.net/p/linux-ima/mailman/message/34145236/ https://bugzilla.redhat.com/show_bug.cgi?id=1226948
2015-06-03kdbus: remove attach_flags_mask module parameter settingKay Sievers1-3/+0
2015-06-01load-fragment: use UNESCAPE_RELAX flag to parse exec directivesDaniel Mack1-1/+1
The cunescape() helper function used to handle unknown escaping sequences gracefully by copying them over verbatim. Commit 527b7a42 ("util: rework cunescape(), improve error handling") added a flag to make that behavior optional, and changed to default to error out with -EINVAL otherwise. However, config_parse_exec(), which is used to parse the Exec{Start,Stop}{Post,Pre,} directives of unit files, was not changed along with that commit, which means that directives with improperly escaped command line strings are no longer parsed. Relevant bugreports include: https://bugs.freedesktop.org/show_bug.cgi?id=90794 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787256 Fix this by passing UNESCAPE_RELAX to config_parse_exec() in order to restore the original behavior.
2015-05-31core/namespace: Protect /usr instead of /home with ProtectSystem=yesJason Pleau1-1/+1
A small typo in ee818b8 caused /home to be put in read-only instead of /usr when ProtectSystem was enabled (ie: not set to "no").