summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
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.
2013-03-04add initrd-fs.target and initrd-fs-pre.targetHarald Hoyer
2013-03-04core/manager: fix conditions to start and stop watching running jobsMichal Schmidt
Harald encountered division by zero in manager_print_jobs_in_progress. Clearly we had the watch enabled when we shouldn't - there were no running jobs in m->jobs, only waiting ones. This is either a deadlock, or maybe some of them would be detected as runnable in the next dispatch of the run queue. In any case we mustn't crash. Fix it by starting and stopping the watch based on n_running_jobs instead of the number of all jobs.
2013-03-03core/path: install inotify watches top-down instead of bottom-upZbigniew Jędrzejewski-Szmek
When watches are installed from the bottom, it is always possible to race, and miss a file creation event. The race can be avoided if a watch is first established for a parent directory, and then for the file in the directory. If the file is created in the time between, the watch on the parent directory will fire. Some messages (mostly at debug level) are added to help diagnose pidfile issues. Should fix https://bugzilla.redhat.com/show_bug.cgi?id=917075.
2013-03-03core/service: use cleanup functions, wrap linesZbigniew Jędrzejewski-Szmek
2013-03-03core/path: catch errors when adding watchesZbigniew Jędrzejewski-Szmek
Errors because of oom conditions or descriptor exhaustion should not be ignored. We probably cannot recover from those conditions. Current behaviour wrt. insufficient permissions is described in the man page. It might make sense in case of user sessions, so I left it as is.
2013-03-03core/path: modernize styleZbigniew Jędrzejewski-Szmek
2013-03-03core/path: use automatic cleanupZbigniew Jędrzejewski-Szmek
... and fix bogus return code on malloc failure.
2013-03-03core/path: fix a leak in success pathZbigniew Jędrzejewski-Szmek
... and use automatic cleanup.
2013-03-02job: print the "OK" status messages in normal greenMichal Schmidt
The "OK" status messages should not draw attention to themselves. It's better if they're not printed in bright/bold. Leave that to errors and warnings. Use a plain inconspicuous enterprisey green.
2013-03-02manager: turn a superfluous check into assertMichal Schmidt
The crash that the check prevented has been fixed by commit 9e9e2b7.
2013-03-02unit: count deserialized job only after it's definitely installedMichal Schmidt
Installation of a deserialized job may fail (though purely in theory), so increase the running job counter only when succeeding.
2013-03-01manager: print p and then free itLukas Nykryn
2013-03-01core: fix running jobs counters after reload/reexecMichal Schmidt
All active units will call unit_notify() during coldplug, so we just make sure we're counting from zero again and get the correct result for n_on_console. For n_running_jobs we likewise reset it to zero and then count the running jobs as we encounter them in deserialization.
2013-03-01unit: fix the race in deserialization.Oleksii Shevchuk
unit_notify is fired in deserelization code (particulary in service_set_state). Units passed in random order, and there is possibility, that unit with StopWhenUnneeded=yes passed before it actual dependecies. In that case unit will be stopped as unneeded, because deps in UNIT_INACTIVE state yet. So, reuse similar logic (unit.c:1421) to avoid this race
2013-03-01manager: prevent segfault in manager_print_jobs_in_progress()Harald Hoyer
2013-03-01specifier: when resolving specifier strings when loading configuration, ↵Lennart Poettering
don't misunderstand parse failures as OOM http://lists.freedesktop.org/archives/systemd-devel/2013-February/009179.html
2013-03-01fstab,mount: detect rbind as bind mountFrederic Crozat
Correctly detect rbind mount option as bind mount. Fixes https://bugzilla.novell.com/show_bug.cgi?id=804575.
2013-02-28core/manager: print status messages about running jobsMichal Schmidt
Sometimes the boot gets stuck until a timeout hits. The usual timeouts are on the order of minutes, so users may lose patience. Print animated status messages telling the names of units with running jobs to make it easy to see what systemd is waiting for. The animation looks cooler with a shorter interval, but 1 s is OK and should not be too hard on slow serial console users.
2013-02-28core: count active units that may mind our printing to /dev/consoleMichal Schmidt