summaryrefslogtreecommitdiff
path: root/src/core
Commit message (Collapse)AuthorAge
* Assorted format fixesZbigniew Jędrzejewski-Szmek2015-01-22
| | | | | Types used for pids and uids in various interfaces are unpredictable. Too bad.
* util: make http url validity checks more generic, and move them to util.cLennart Poettering2015-01-20
|
* cgroup: fix typoDaniel Mack2015-01-19
|
* core: write kdbus.attach_flags_mask only on real bootDavid Herrmann2015-01-18
| | | | | | 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.
* bus: use EUID over UID and fix unix-credsDavid Herrmann2015-01-18
| | | | | | | | | | | | | | | | | | | | | 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.
* remove unneeded libgen.h includesCristian Rodríguez2015-01-17
|
* core: Fix EACCES check for OOM adjustmentsMartin Pitt2015-01-13
| | | | Commit 3bd5c3 added a check for EACCES, but missed the minus sign.
* core/mount: remove "fail" againZbigniew Jędrzejewski-Szmek2015-01-12
| | | | | | | 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.
* sd-bus: sync kdbus.h (API break)Daniel Mack2015-01-12
| | | | | Just a simple variable rename, and a dropped flag that sd-bus didn't make use of.
* core/mount: use isempty() to check for empty stringsDaniel Mack2015-01-12
| | | | | | | | | 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").
* core/load-fragment: avoid allocating 0 bytes when given an invalid commandZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | With a command line like "@/something" we would allocate an array with 0 elements. Avoid that, and add a test too.
* core/mount: filter out noauto,auto,nofail,fail optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | 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
* Add new function to filter fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | 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.
* Implement masking and overriding of generatorsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | | | 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
* Simplify execute_directory()Zbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | 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.
* 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.
* service: automatically create After= dependency from services to their ↵Lennart Poettering2015-01-07
| | | | .busname units, if BusName= is set
* conf-parse: don't accept invalid bus names as BusName= arguments in service ↵Lennart Poettering2015-01-07
| | | | units
* core: implement serialization/deserialization of fd store elementsLennart Poettering2015-01-07
|
* 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.
* core: add new logic for services to store file descriptors in PID 1Lennart Poettering2015-01-06
| | | | | | | | | | | | | | 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.
* cgroup: memory limits on / are not supportedZbigniew Jędrzejewski-Szmek2015-01-05
|
* cgroup: fix error messageZbigniew Jędrzejewski-Szmek2015-01-05
| | | | systemd[1]: Failed to set memory.limit_in_bytes on : Invalid argument
* 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.
* core: rework counting of running jobsLennart Poettering2015-01-05
| | | | | | | | | | | | | 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.
* core: fix typo in log messageMichael Biebl2015-01-05
|
* nspawn: mount most of the cgroup tree read-only in nspawn containers except ↵Lennart Poettering2015-01-05
| | | | | | | 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.
* cgroup: downgrade log messages when we cannot write to cgroup trees that are ↵Lennart Poettering2015-01-05
| | | | mounted read-only
* mount: do not use -n when running in --user modeZbigniew Jędrzejewski-Szmek2015-01-01
| | | | | | | | -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
* Type of mount(2) flags is unsigned longTopi Miettinen2015-01-01
|
* tree-wide: spelling fixesVeres Lajos2014-12-30
| | | | | | | https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
* core: loopback - correctly fail the loopback_check if somehow the rtnl calls ↵Tom Gundersen2014-12-29
| | | | fail
* core: loopback - simplify check_loopback()Tom Gundersen2014-12-28
| | | | | | 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.
* tmpfiles: add new line type 'v' for creating btrfs subvolumesLennart Poettering2014-12-28
|
* Fix check_loopback()Stéphane Graber2014-12-27
| | | | | Add missing htonl() so that check_loopback() actually tests for 127.0.0.1 instead of 1.0.0.127 on little-endian machines.
* util: fix strict aliasing violations in use of struct inotify_event v5Shawn Paul Landden2014-12-24
| | | | | 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.
* bus: add missing bus-policy.[ch]Lennart Poettering2014-12-23
| | | | Accidentally forgot to commit this. Sorry!
* build-sys: move core/build.h → shared/build.hLennart Poettering2014-12-23
| | | | | | | | 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.
* 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!
* run: add a new "-t" mode for invoking a binary on an allocated TTYLennart Poettering2014-12-23
|
* busname: fix CMD_FREE ioctlDaniel Mack2014-12-22
| | | | The KDBUS_CMD_FREE ioctl struct has a size field now, which needs to be set.
* util: rename ignore_file() to hidden_file()Lennart Poettering2014-12-19
| | | | | hidden_file() is a bit more precise, since dot files usually shouldn't be ignored, but certainly be considered hidden.
* execute: the runtime directory can only be on tmpfs, hence don't use ↵Lennart Poettering2014-12-19
| | | | rm_rf_dangerous() needlessly
* load-fragment: allow quoting in command name and document allowed escapesZbigniew Jędrzejewski-Szmek2014-12-18
| | | | | | | | | 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
* tree-wide: make condition_free_list return NULLZbigniew Jędrzejewski-Szmek2014-12-18
|
* core: make exec_command_free_list return NULLZbigniew Jędrzejewski-Szmek2014-12-18
|
* core: use raw_clone instead of fork in signal handlerZbigniew Jędrzejewski-Szmek2014-12-18
| | | | | | | | | | | | 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