summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2015-01-19cgroup: fix typoDaniel Mack
2015-01-18core: write kdbus.attach_flags_mask only on real bootDavid Herrmann
The kernel module system is not namespaced, so no container should ever modify global options. Make sure we set the kdbus attach_flags_mask only on a real boot as PID1.
2015-01-18bus: use EUID over UID and fix unix-credsDavid Herrmann
Whenever a process performs an action on an object, the kernel uses the EUID of the process to do permission checks and to apply on any newly created objects. The UID of a process is only used if someone *ELSE* acts on the process. That is, the UID of a process defines who owns the process, the EUID defines what privileges are used by this process when performing an action. Process limits, on the other hand, are always applied to the real UID, not the effective UID. This is, because a process has a user object linked, which always corresponds to its UID. A process never has a user object linked for its EUID. Thus, accounting (and limits) is always done on the real UID. This commit fixes all sd-bus users to use the EUID when performing privilege checks and alike. Furthermore, it fixes unix-creds to be parsed as EUID, not UID (as the kernel always takes the EUID on UDS). Anyone using UID (eg., to do user-accounting) has to fall back to the EUID as UDS does not transmit the UID.
2015-01-17remove unneeded libgen.h includesCristian Rodríguez
2015-01-13core: Fix EACCES check for OOM adjustmentsMartin Pitt
Commit 3bd5c3 added a check for EACCES, but missed the minus sign.
2015-01-12core/mount: remove "fail" againZbigniew Jędrzejewski-Szmek
deb6120920 'man: there's actually no "fail" fstab option, but only "nofail" removed it from our documentation, which I missed. fstab(5) only mentions "auto", "noauto", and "nofail". Stick to those three.
2015-01-12sd-bus: sync kdbus.h (API break)Daniel Mack
Just a simple variable rename, and a dropped flag that sd-bus didn't make use of.
2015-01-12core/mount: use isempty() to check for empty stringsDaniel Mack
strempty() will return an empty string in case the input parameter is a NULL pointer. The correct test to check for an empty string is isempty(), so use that instead. This fixes a regression from commit 17a1c59 ("core/mount: filter out noauto,auto,nofail,fail options").
2015-01-11core/load-fragment: avoid allocating 0 bytes when given an invalid commandZbigniew Jędrzejewski-Szmek
With a command line like "@/something" we would allocate an array with 0 elements. Avoid that, and add a test too.
2015-01-11core/mount: filter out noauto,auto,nofail,fail optionsZbigniew Jędrzejewski-Szmek
We passed the full option string from fstab to /bin/mount. It would in turn pass the full option string to its helper, if it needed to invoke one. Some helpers would ignore things like "nofail", but others would be confused. We could try to get all helpers to ignore those "meta-options", but it seems better to simply filter them out. In our model, /bin/mount simply has no business in knowing whether the mount was configured as fail or nofail, auto or noauto, in the fstab. If systemd tells invokes a command to mount something, and it fails, it should always return an error. It seems cleaner to filter out the option, since then there's no doubt how the command should behave. https://bugzilla.redhat.com/show_bug.cgi?id=1177823
2015-01-11Add new function to filter fstab optionsZbigniew Jędrzejewski-Szmek
This fixes parsing of options in shared/generator.c. Existing code had some issues: - it would treate whitespace and semicolons as seperators. fstab(5) is pretty clear that only commas matter. And the syntax does not allow for spaces to be inserted in the field in fstab. Whitespace might be escaped, but then it should not seperate options. Treat whitespace and semicolons as any other character. - it assumed that x-systemd.device-timeout would always be followed by "=". But this is not guaranteed, hasmntopt will return this option even if there's no value. Uninitialized memory could be read. - some error paths would log, and inconsistently, some would just return an error code. Filtering is split out to a separate function and tests are added. Similar code paths in other places are adjusted to use the new function.
2015-01-11Implement masking and overriding of generatorsZbigniew Jędrzejewski-Szmek
Sometimes it is necessary to stop a generator from running. Either because of a bug, or for testing, or some other reason. The only way to do that would be to rename or chmod the generator binary, which is inconvenient and does not survive upgrades. Allow masking and overriding generators similarly to units and other configuration files. For the systemd instance, masking would be more common, rather than overriding generators. For the user instances, it may also be useful for users to have generators in $XDG_CONFIG_HOME to augment or override system-wide generators. Directories are searched according to the usual scheme (/usr/lib, /usr/local/lib, /run, /etc), and files with the same name in higher priority directories override files with the same name in lower priority directories. Empty files and links to /dev/null mask a given name. https://bugs.freedesktop.org/show_bug.cgi?id=87230
2015-01-11Simplify execute_directory()Zbigniew Jędrzejewski-Szmek
Remove the optional sepearate opening of the directory, it would be just too complicated with the change to multiple directories. Move the middle of execute_directory() to a seperate function to make it easier to grok.
2015-01-09core: modernize execution code a bitLennart Poettering
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().
2015-01-08core: check both EPERM and EACCES for OOM adjustmentsLennart Poettering
2015-01-08core: make EPERM errors when applying OOM adjustment for forked processes ↵Lennart Poettering
non-fatal This should be useful for user namespaces.
2015-01-07service: automatically create After= dependency from services to their ↵Lennart Poettering
.busname units, if BusName= is set
2015-01-07conf-parse: don't accept invalid bus names as BusName= arguments in service ↵Lennart Poettering
units
2015-01-07core: implement serialization/deserialization of fd store elementsLennart Poettering
2015-01-06tree-wide: remove unnecessary LOG_PRIZbigniew Jędrzejewski-Szmek
LOG_DEBUG is already a log level, there is no need to use LOG_PRI which is for filtering out the facility.
2015-01-06core: add new logic for services to store file descriptors in PID 1Lennart Poettering
With this change it is possible to send file descriptors to PID 1, via sd_pid_notify_with_fds() which PID 1 will store individually for each service, and pass via the usual fd passing logic on next invocation. This is useful for enable daemon reload schemes where daemons serialize their state to /run, push their fds into PID 1 and terminate, restoring their state on next start from the data in /run and passed in from PID 1. The fds are kept by PID 1 as long as no POLLHUP or POLLERR is seen on them, and the service they belong to are either not dead or failed, or have a job queued.
2015-01-05cgroup: memory limits on / are not supportedZbigniew Jędrzejewski-Szmek
2015-01-05cgroup: fix error messageZbigniew Jędrzejewski-Szmek
systemd[1]: Failed to set memory.limit_in_bytes on : Invalid argument
2015-01-05journal: call connect() with dropped privilegesZbigniew Jędrzejewski-Szmek
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.
2015-01-05core: rework counting of running jobsLennart Poettering
Let's unify the code that counts the running jobs a bit, in order to make sure we are less likely to miss one. This is related to this bug: https://bugs.freedesktop.org/show_bug.cgi?id=87349 However, it probably won't fix it fully, and I cannot reproduce the issue. The change also adds an explicit assert change when the counter is off.
2015-01-05core: fix typo in log messageMichael Biebl
2015-01-05nspawn: mount most of the cgroup tree read-only in nspawn containers except ↵Lennart Poettering
for the container's own subtree in the name=systemd hierarchy More specifically mount all other hierarchies in their entirety and the name=systemd above the container's subtree read-only.
2015-01-05cgroup: downgrade log messages when we cannot write to cgroup trees that are ↵Lennart Poettering
mounted read-only
2015-01-01mount: do not use -n when running in --user modeZbigniew Jędrzejewski-Szmek
-n is only allowed for root. /etc/mtab is nowadays almost always a link to /proc/, so in practice this does not really matter too much, but should allow .mount units to work in --user mode. https://bugs.freedesktop.org/show_bug.cgi?id=87602
2015-01-01Type of mount(2) flags is unsigned longTopi Miettinen
2014-12-30tree-wide: spelling fixesVeres Lajos
https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-12-29core: loopback - correctly fail the loopback_check if somehow the rtnl calls ↵Tom Gundersen
fail
2014-12-28core: loopback - simplify check_loopback()Tom Gundersen
We no longer configure the addresses on the loopback interface, but simply bring it up and let the kernel do the rest. Also change the check to only check if the interface is up, rather than checking for the IPv4 loopback address.
2014-12-28tmpfiles: add new line type 'v' for creating btrfs subvolumesLennart Poettering
2014-12-27Fix check_loopback()Stéphane Graber
Add missing htonl() so that check_loopback() actually tests for 127.0.0.1 instead of 1.0.0.127 on little-endian machines.
2014-12-24util: fix strict aliasing violations in use of struct inotify_event v5Shawn Paul Landden
There is alot of cleanup that will have to happen to turn on -fstrict-aliasing, but I think our code should be "correct" to the rule.
2014-12-23bus: add missing bus-policy.[ch]Lennart Poettering
Accidentally forgot to commit this. Sorry!
2014-12-23build-sys: move core/build.h → shared/build.hLennart Poettering
After all, pretty much all our tools include it, and it should hence be shared. Also move sysfs-show.h from core/ to login/, since it has no point to exist in core.
2014-12-23env-util: don't include files from src/core/Lennart Poettering
2014-12-23core: rearrange code so that libsystemd/sd-bus/ does not include header ↵Lennart Poettering
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!
2014-12-23run: add a new "-t" mode for invoking a binary on an allocated TTYLennart Poettering
2014-12-22busname: fix CMD_FREE ioctlDaniel Mack
The KDBUS_CMD_FREE ioctl struct has a size field now, which needs to be set.
2014-12-19util: rename ignore_file() to hidden_file()Lennart Poettering
hidden_file() is a bit more precise, since dot files usually shouldn't be ignored, but certainly be considered hidden.
2014-12-19execute: the runtime directory can only be on tmpfs, hence don't use ↵Lennart Poettering
rm_rf_dangerous() needlessly
2014-12-18load-fragment: allow quoting in command name and document allowed escapesZbigniew Jędrzejewski-Szmek
The handling of the command name and other arguments is unified. This simplifies things and should make them more predictable for users. Incidentally, this makes ExecStart handling match the .desktop file specification, apart for the requirment for an absolute path. https://bugs.freedesktop.org/show_bug.cgi?id=86171
2014-12-18tree-wide: make condition_free_list return NULLZbigniew Jędrzejewski-Szmek
2014-12-18core: make exec_command_free_list return NULLZbigniew Jędrzejewski-Szmek
2014-12-18core: use raw_clone instead of fork in signal handlerZbigniew Jędrzejewski-Szmek
fork() is not async-signal-safe and calling it from the signal handler could result in a deadlock when at_fork() handlers are called. Using the raw clone() syscall sidesteps that problem. The tricky part is that raise() does not work, since getpid() does not work. Add raw_getpid() to get the real pid, and use kill() instead of raise(). https://bugs.freedesktop.org/show_bug.cgi?id=86604
2014-12-17load-fragment: properly unescape \;tomsod-m ya ru
https://bugs.freedesktop.org/show_bug.cgi?id=87393
2014-12-16Move dropin listing to sharedZbigniew Jędrzejewski-Szmek
No functional change. This is in preparation for using this in systemctl in the future.