summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2013-03-31Remove some dead codeZbigniew Jędrzejewski-Szmek
Based on coverity report.
2013-03-30dbus: let's make this const array staticLennart Poettering
2013-03-30killall: print notice what we forcefully KILLKay Sievers
2013-03-29unit: replace remote-fs-setup.target by network-online.targetLennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=787314
2013-03-27core: check return value of rm_rf_dangerous and warn if it failsVáclav Pavlín
2013-03-26Simplify the meaning of %sZbigniew Jędrzejewski-Szmek
The rules governing %s where just too complicated. First of all, looking at $SHELL is dangerous. For systemd --system, it usually wouldn't be set. But it could be set if the admin first started a debug shell, let's say /sbin/sash, and then launched systemd from it. This shouldn't influence how daemons are started later on, so is better ignored. Similar reasoning holds for session mode. Some shells set $SHELL, while other set it only when it wasn't set previously (e.g. zsh). This results in fragility that is better avoided by ignoring $SHELL totally. With $SHELL out of the way, simplify things by saying that %s==/bin/sh for root, and the configured shell otherwise. get_shell() is the only caller, so it can be inlined. Fixes one issue seen with 'make check'.
2013-03-27units: automatically order all mount units after network.targetLennart Poettering
Previously it was necessary to pull in remote-fs-pre.target to order the mount units against network.target since the ordering was done transitively via remote-fs-pre.target. As network implementations shouldn't need to know about the specific use-case of network mounts we instead now simply order network.target against all mounts too. This should make it unnecessary for network managing services to import remote-fs-pre.target explicitly, as network.target will now suffice.
2013-03-25units: introduce remote-fs-setup.target to pull in dependencies from remote ↵Lennart Poettering
mounts This introduces remote-fs-setup.target independently of remote-fs-pre.target. The former is only for pulling things in, the latter only for ordering. The new semantics: remote-fs-setup.target: is pulled in automatically by all remote mounts. Shall be used to pull in other units that want to run when at least one remote mount is set up. Is not ordered against the actual mount units, in order to allow activation of its dependencies even 'a posteriori', i.e. when a mount is established outside of systemd and is only picked up by it. remote-fs-pre.target: needs to be pulled in automatically by the implementing service, is otherwise not part of the initial transaction. This is ordered before all remote mount units. A service that wants to be pulled in and run before all remote mounts should hence have: a) WantedBy=remote-fs-setup.target -- so that it is pulled in b) Wants=remote-fs-pre.target + Before=remote-fs-pre.target -- so that it is ordered before the mount point, normally.
2013-03-25units: introduce new timers.target and paths.target to hook timer/path units ↵Lennart Poettering
into for boot
2013-03-25core: ensure LSB Provides are handled correctlyFrederic Crozat
Let's say you have two initscripts, A and B: A contains in its LSB header: Required-Start: C and B contains in its LSB header: Provides: C When systemd is parsing /etc/rc.d/, depending on the file order, you can end up with either: - B is parsed first. An unit "C.service" will be "created" and will be added as additional name to B.service, with unit_add_name. No bug. - A is parsed first. An unit "C.service" is created for the "Required-Start" dependency (it will have no file attached, since nothing provides this dependency yet). Then B is parsed and when trying to handle "Provides: C", unit_add_name is called but will fail, because "C.service" already exists in manager->units. Therefore, a merge should occur for that case.
2013-03-25timer: downgrade time change message to debugMichal Schmidt
The manager already prints "Time has been changed" at level info. It seems too verbose to print the time change message additionally for every waiting timer unit. Downgrade the per-unit message to debug.
2013-03-24service: no need to drop rc. prefix anymoreMiklos Vajna
This reverts commit f5c88ec1330b61787441156de7d764a140774bd2. It is no longer necessary, and adds unnecessary magic.
2013-03-23unit: never retroactively start requisitesLennart Poettering
Requesites are not supposed to be auto-started afterall, they are just checks, so don't try to be smarter here than appropriate. Based on a patch from Michal Schmidt.
2013-03-22exec: Assigning the empty string to CapabilityBoundSet= should drop all capsLennart Poettering
Previously, it would set all caps, but it should drop them all, anything else makes little sense. Also, document that this works as it does, and what to do in order to assign all caps to the bounding set. https://bugzilla.redhat.com/show_bug.cgi?id=914705
2013-03-22main: minor simplificationLennart Poettering
2013-03-22cgroup: minor optimizationLennart Poettering
2013-03-22mount: mount all cgroup controllers in containers, tooLennart Poettering
2013-03-22main: use strv_find() where we canLennart Poettering
2013-03-22main: don't mount cgroup controller unless PID == 1Lennart Poettering
This completes c1dae1b3c9729fb8ab749dd4e2dad07e0fad7ed8 in a way.
2013-03-20Make two functions staticZbigniew Jędrzejewski-Szmek
2013-03-20core: remove unnecessary goto in setup_namespaceZbigniew Jędrzejewski-Szmek
2013-03-20Make PrivateTmp dirs also inaccessible from the outsideZbigniew Jędrzejewski-Szmek
Currently, PrivateTmp=yes means that the service cannot see the /tmp shared by rest of the system and is isolated from other services using PrivateTmp, but users can access and modify /tmp as seen by the service. Move the private /tmp and /var/tmp directories into a 0077-mode directory. This way unpriviledged users on the system cannot see (or modify) /tmp as seen by the service.
2013-03-18Use bus_maybe_send_reply() where applicableColin Walters
This is a followup to: commit 1a37b9b9043ef83e9900e460a9a1fccced3acf89 It will fix denial messages from dbus-daemon between gdm and systemd-logind on logging into GNOME due to this. See the previous commit for more details.
2013-03-15timer: fix grammar in messageZbigniew Jędrzejewski-Szmek
2013-03-15core: reuse the same /tmp, /var/tmp and inaccessible dirMichal Sekletar
All Execs within the service, will get mounted the same /tmp and /var/tmp directories, if service is configured with PrivateTmp=yes. Temporary directories are cleaned up by service itself in addition to systemd-tmpfiles. Directory which is mounted as inaccessible is created at runtime in /run/systemd.
2013-03-15smack-setup: enable Smack/CIPSO mappingNathaniel Chen
CIPSO is the Common IP Security Option, an IETF standard for setting security levels for a process sending packets. In Smack kernels, CIPSO headers are mapped to Smack labels automatically, but can be changed. This patch writes label/category mappings from /etc/smack/cipso/ to /sys/fs/smackfs/cipso2. The mapping format is "%s%4d%4d"["%4d"]... For more information about Smack and CIPSO, see: https://kernel.org/doc/Documentation/security/Smack.txt
2013-03-15smack-setup: extract rule writing into a separate functionZbigniew Jędrzejewski-Szmek
Check all errors.
2013-03-15core: keep mountinfo .mounts until late shutdownUmut Tezduyar
.mount units coming from /proc/self/mountinfo file are unmounted after local-fs.target is reached during shutdown. Problem: .mount units popping up in mountinfo file are added to systemd without any dependency. For that reason, they are the first one to be unmounted during shutdown. Whichever program mounted the file system deserves a chance to also unmount it. This patch ensures that /proc/self/mountinfo units will be unmounted after local-fs.target during shutdown (if they haven't been unmounted already)
2013-03-15sd-booted: update sd_booted() check a bitLennart Poettering
Previously we were testing whether /sys/fs/cgroup/systemd/ was a mount point. This might be problematic however, when the cgroup trees are bind mounted into a container from the host (which should be absolutely valid), which might create the impression that the container was running systemd, but only the host actually is. Replace this by a check for the existance of the directory /run/systemd/system/, which should work unconditionally, since /run can never be a bind mount but *must* be a tmpfs on systemd systems, which is flushed at boots. This means that data in /run always reflects information about the current boot, and only of the local container, which makes it the perfect choice for a check like this. (As side effect this is nice to Ubuntu people who now use logind with the systemd cgroup hierarchy, where the old sd_booted() check misdetects systemd, even though they still run legacy Upstart.)
2013-03-15Make initrd.target the default target in the initrdHarald Hoyer
First, rename root-fs.target to initrd-root-fs.target to clarify its usage. Mount units with "x-initrd-rootfs.mount" are now ordered before initrd-root-fs.target. As we sometimes construct /sysroot mounts in /etc/fstab in the initrd, we want these to be mounted before the initrd-root-fs.target is active. initrd.target can be the default target in the initrd. (normal startup) : : v basic.target | ______________________/| / | | sysroot.mount | | | v | initrd-root-fs.target | | | v | initrd-parse-etc.service (custom initrd services) | | v | (sysroot-usr.mount and | various mounts marked | with fstab option | x-initrd.mount) | | | v | initrd-fs.target | | \______________________ | \| v initrd.target | v initrd-cleanup.service isolates to initrd-switch-root.target | v ______________________/| / | | initrd-udevadm-cleanup-db.service | | (custom initrd services) | | | \______________________ | \| v initrd-switch-root.target | v initrd-switch-root.service | v switch-root
2013-03-14main: don't mount /sys, /dev and friends when we run with PID != 1Lennart Poettering
Back from old times when we developed systemd on non-systemd hosts we still mounted the missing directories such as the cgroup stuff even when running with a PID != 1. There's no point for that anymore, so let's just do that if we are actually PID 1, and never otherwise. https://bugs.freedesktop.org/show_bug.cgi?id=62354
2013-03-13core: single unit_kill implementation for all unit typesMichal Schmidt
There are very few differences in the implementations of the kill method in the unit types that have one. Let's unify them. This does not yet unify unit_kill() with unit_kill_context().
2013-03-13util, manager: and mempset() and use itMichal Schmidt
Just like mempcpy() is almost identical to memcpy() except the useful return value, so is the relation of mempset() to memset().
2013-03-13manager: use more stpcpy()Michal Schmidt
2013-03-13add initrd-fs.target and root-fs.targetHarald Hoyer
Instead of using local-fs*.target in the initrd, use root-fs.target for sysroot.mount and initrd-fs.target for /sysroot/usr and friends. Using local-fs.target would mean to carry over the activated local-fs.target to the isolated initrd-switch-root.target and thus in the real root. Having local-fs.target already active after deserialization causes ordering problems with the real root services and targets. We better isolate to targets for initrd-switch-root.target, which are only available in the initrd.
2013-03-13manager: push back animation timer whenever a job finishesMichal Schmidt
The running jobs animation is supposed to hide itself when jobs are progressing sufficiently fast.
2013-03-12core: fix getting information about mount unitMichal Sekletar
We should not try to get information about mount unit from fragment if the unit was created because of /proc/self/mountinfo event.
2013-03-11core/smack: downgrade info to debugZbigniew Jędrzejewski-Szmek
BogdanR> I think it's cool it supports SMACK and that it encourages them to use a propper mount point for smackfs but I don't think it's cool that it's printing on the screen even when I parse quiet to the kernel that "SMACK support is not enabled ...".
2013-03-11Move udevadm to rootbindirMichael Biebl
The udevadm utility is needed during early boot, so move it to rootbindir to support split-/usr configurations.
2013-03-08path: avoid an allocation in path_spec_watchMichal Schmidt
No need for strdup. We can slice the path in place if we always undo it afterwards.
2013-03-07core: if we cannot JOB_ISOLATE the default target JOB_REPLACE it insteadsystemd/v198Lennart Poettering
In order to maintain compatibility with older initrds which do not have AllowIsolate=yes set for their target units, fallback to JOB_REPLACE if JOB_ISOLATE doesn't work, but complain about it.
2013-03-07core: mount and initialize SmackNathaniel Chen
SMACK is the Simple Mandatory Access Control Kernel, a minimal approach to Access Control implemented as a kernel LSM. The kernel exposes the smackfs filesystem API through which access rules can be loaded. At boot time, we want to load the access rules as early as possible to ensure all early boot steps are checked by Smack. This patch mounts smackfs at the new location at /sys/fs/smackfs for kernels 3.8 and above. The /smack mountpoint is not supported. After mounting smackfs, rules are loaded from the usual location. For more information about Smack see: http://www.kernel.org/doc/Documentation/security/Smack.txt
2013-03-07core: move mount_setup_early() to main.cNathaniel Chen
move mount_setup_early() call to main.c, before security module setup, so there are no more repeat calls.
2013-03-07core: don't complain about systemd.journald.xxx kernel command line ↵Lennart Poettering
arguments in PID 1 https://bugzilla.redhat.com/show_bug.cgi?id=880025
2013-03-06service: sysv - properly handle init scripts with .sh suffixMichael Biebl
Dropping the distribution specific #ifdefs in 88516c0c952b9502e8ef1d6a1481af61b0fb422d broke the .sh suffix stripping since we now always used the else clause of the rc. check. We eventually want to drop the rc. prefix stripping, but for now we assume that no sysv init script uses both an rc. prefix and .sh suffix, so make the check for the .sh suffix and rc. prefix mutually exclusive.
2013-03-06core: add missing comma for NonewPrivileges=Lennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=917404
2013-03-06bus: Escape environment-based D-Bus addresses properlySimon McVittie
If XDG_RUNTIME_DIR contains a character like ":" (for instance if it's formed from an X11 display name), then it isn't valid to substitute it into a D-Bus address without escaping. http://bugs.freedesktop.org/show_bug.cgi?id=60499
2013-03-06manager: remove timer fd explicitly from epollEnrico Scholz
Forked processes can keep the old fd alive triggering epoll over and over again else. https://bugs.freedesktop.org/show_bug.cgi?id=61697
2013-03-06main: ISOLATE rather than REPLACE default.targetTom Gundersen
This allows switch-root to work correctly if a unit is active both before and after the switch-root, but its dependencies change. Before the patch, any dependencies added to active units by switch-root will not be pulled, in particular filesystems configured in /etc/fstab would not be activated if local-fs.target was active in the initrd. It is not clear to me if there is a bug in the REPLACE handling, or if it is working as expected and that we really want to use ISOLATE instead as this patch does.
2013-03-06Revert "add initrd-fs.target and initrd-fs-pre.target"Harald Hoyer
This reverts commit 39b83cdab37623a546344622db9bbbc784c15df5.