summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-12-19cryptsetup: use uint64_t for keyfile-offset= (#7689)Zbigniew Jędrzejewski-Szmek1-2/+11
On 32bit, refuse large offsets. Once https://gitlab.com/cryptsetup/cryptsetup/issues/359 is resolved, we should switch to the new api, whatever it is. Fixes #7677.
2017-12-18analyze: use normal bus connection for "plot" verb (#7685)Zbigniew Jędrzejewski-Szmek1-1/+8
We need to connect to hostnamed, so a private bus connection is no good. It'd be simpler to use the normal bus connection unconditionally, but that'd mean that e.g. systemd-analyze set-log-level might not work in emergency mode. So let's keep trying to use the private connection except for "plot". Fixes #7667.
2017-12-18Merge pull request #7687 from hbakken/work/add-missing-features2Lennart Poettering4-0/+61
Kernel 3.10 compat
2017-12-18cryptsetup-generator: Don't mistake NULL input as OOM (#7688)Jan Alexander Steffens1-2/+2
Since systemd v236, several Arch users complained that systemd-cryptsetup-generator exits with an OOM error and that it prevents the boot from continuing. Investigating the diff of cryptsetup-generator between v235 and v236 I noticed that create_disk allowed for the `password` and `filtered` variables to be NULL (they're handled with `strempty()`) but not their `*_escaped` versions, and returned OOM errors in those cases. Fix this by checking that the input string is non-NULL before deciding that `specifier_escape` had an OOM error. I could not test this fix myself, but some users have reported success. Downstream bug: https://bugs.archlinux.org/task/56733
2017-12-18missing: Add DM_DEFERRED_REMOVEHenrik Grindal Bakken2-0/+5
Also include missing.h in dissect-image.c to pick it up.
2017-12-18missing: Define SMACK_MAGIC if it's missingHenrik Grindal Bakken1-0/+4
2017-12-18nspawn: Include missing.hHenrik Grindal Bakken1-0/+1
2017-12-18missing: Define EFIVARFS_MAGIC if missingHenrik Grindal Bakken1-0/+4
2017-12-18missing: Add MAX_HANDLE_SZHenrik Grindal Bakken1-0/+4
2017-12-18missing: Add PR_SET_MM_{ARG,ENV}_{START,END}Henrik Grindal Bakken1-0/+16
2017-12-18missing: Add some more btrfs structs and constantsHenrik Grindal Bakken1-0/+26
2017-12-18btrfs: Include missing.h in btrfs-ctree.hHenrik Grindal Bakken1-0/+1
2017-12-18condition: Create AssertControlGroupController (#7630)Chris Down4-0/+106
Up until now, the behaviour in systemd has (mostly) been to silently ignore failures to action unit directives that refer to an unavailble controller. The addition of AssertControlGroupController and its conditional counterpart allow explicit specification of the desired behaviour when such a situation occurs. As for how this can happen, it is possible that a particular controller is not available in the cgroup hierarchy. One possible reason for this is that, in the running kernel, the controller simply doesn't exist -- for example, the CPU controller in cgroup v2 has only recently been merged and was out of tree until then. Another possibility is that the controller exists, but has been forcibly disabled by `cgroup_disable=` on the kernel command line. In future this will also support whatever comes out of issue #7624, `DefaultXAccounting=never`, or similar.
2017-12-18Merge pull request #7665 from poettering/main-cleanupZbigniew Jędrzejewski-Szmek2-227/+348
let's split up main() into more functions, to make it digestable
2017-12-16meson: libudev_core and udevadm should have LOG_REALM=LOG_REALM_UDEV (#7666)Franck Bui1-0/+1
Otherwise, setting udev_log=debug in /etc/udev/udev.conf has no effects since systemd-udevd is built with LOG_REALM=LOG_REALM_UDEV. However using LOG_REALM_UDEV (for libudev_core) reveals another similar bug for udevadm which should also define LOG_REALM_UDEV.
2017-12-15Merge pull request #7661 from keszybz/slice-cleanupsLennart Poettering12-113/+162
Slice cleanups and systemd-mount --owner
2017-12-15main: add some more comments for the early initialization phaseLennart Poettering1-4/+7
2017-12-15main: reorder variable declarations a bitLennart Poettering1-17/+10
Let's remove a bit redundancy, and list variables of the same type/category in one declaration line.
2017-12-15main: split out 'skip_setup' check into its own functionsLennart Poettering1-11/+21
And let's optimize it a tiny bit, by only iterating through the argument list once, instead of twice.
2017-12-15main: do bother with uid_to_name() unless we do debug loggingLennart Poettering1-4/+6
2017-12-15main: conditionalize fixup_environment() internallyLennart Poettering1-14/+16
This code is executed before we parse command line/configuration parameters, hence let's not use arg_system to figure our how to clean up things, but instead PID == 1. Let's move that check inside of the function, to make things a bit more robust abstract from the outside. Also, let's add a log message about this, that was so far missing.
2017-12-15main: let's move ACTION_RUN test into initialize_runtime()Lennart Poettering1-8/+9
Let's hide this check inside the function and make it easier to follow the general control flow of main().
2017-12-15mount-setup: fix MNT_CHECK_WRITABLE error handling, and log about the issueLennart Poettering1-5/+10
Let's correct the error handling (the error is in errno, not r), and let's add logging like the rest of the function has it.
2017-12-15main: tweak timerslack message a bitLennart Poettering1-1/+1
Let's clarify that this is a non-issue, by downgrading it to LOG_WARN and saying "ignoring" in the message.
2017-12-15main: move install_crash_handler() and mount_cgroup_controllers() invocationsLennart Poettering1-27/+27
Let's place them in initialize_runtime(), where they appear to fit best. Effectively this is just a move a little bit down, swapping places with log_execution_mode(), which should require neither call to be done first. Note that changes the conditionalization a bit for these calls, from (PID == 1) to (arg_system && arg_action == ACTION_RUN). At this point this is pretty much the same however, as we don't allow PID 1 without ACTION_RUN and without arg_system set, safety_checks() ensures that.
2017-12-15core: move arg_show_status fix-up into load_configuration()Lennart Poettering1-3/+4
It's part of finalizing our runtime parameters, hence let's move this into load_configuration() after we loaded everything else. This is safe, since we don't use it between the location where it was and where we place it now yet.
2017-12-15main: split out code that sets up the console/terminal and stuffLennart Poettering1-12/+19
More refactoring to make main() more digestable.
2017-12-15main: split out code that collects passed fdsLennart Poettering1-10/+23
More refactoring to make main() more digestable
2017-12-15main: slight modernizations for status_welcome()Lennart Poettering1-7/+7
There's no point in duplicating the complex parse_env_file() invocation, hence let's not do it.
2017-12-15main: let's move the arg_show_status check into status_welcome()Lennart Poettering1-3/+4
It's kinda nice to hide this check inside of status_welcome() itself, so that it handles all this on its own.
2017-12-15main: slightly rearrange serialization fdset, and logging/console setupLennart Poettering1-18/+15
Let's merge two if blocks, and move log_close()/log_open() out of the testing codepath, as there's no reason to have it there.
2017-12-15main: move chdir("/") a bit earlierLennart Poettering1-3/+3
There's no need to do this within the block where logging is closed, hence move it earlier, so that this block can be kept as small as possible.
2017-12-15main: move initialize_join_controllers() invocation into load_configuration()Lennart Poettering1-6/+6
This just sets up some variables the loaded configuration will then modify. Let's invoke it hence right before loading the configuration. This moves the initialization just a tiny bit later, but that shouldn't matter, since we never access it in-between.
2017-12-15main: split out taint string logging into its own functionLennart Poettering1-11/+20
It's sufficiently complex now, let's add our own function for this too.
2017-12-15core: add more safety checkLennart Poettering1-0/+19
Let's make sure that if we are PID 1 we are invoked in ACTION_RUN mode, and in arg_system mode, as well as the opposite. Everything else is untested and probably not worth supporting hence let's bail out early if people try anyway.
2017-12-15core: split out test summary output into its own functionLennart Poettering1-5/+11
More refactoring to make main() shorter.
2017-12-15main: split out security policy loading into its own functionLennart Poettering1-11/+43
More refactoring to make things more digestable.
2017-12-15main: invoke pager_open() only at one placeLennart Poettering1-2/+1
Let's just move this up a few lines and unify the invocation.
2017-12-15core: split out various startup safety checks from main() into its own functionLennart Poettering1-26/+37
No functional changes, just some refactoring to make main() more digestable.
2017-12-15main: split out all parsing of command line arguments/kernel ↵Lennart Poettering1-30/+42
arguments/configuration files Let's shorten main() a bit, and split out everything that loads our configuration and runtime parameters into a function of its own. No changes in behaviour.
2017-12-15main: minor optimizationLennart Poettering1-6/+4
Let's remove one memory allocation in the common path.
2017-12-15generator: add helper function for writing unit filesZbigniew Jędrzejewski-Szmek5-66/+73
It doesn't save too much, but it's a common pattern so I think it's worth to factor this out.
2017-12-15mount: add option to specify uid= and gid=Zbigniew Jędrzejewski-Szmek1-3/+52
The kernel needs two numbers, but for the user it's most convenient to provide the user name and have that resolved to uid and gid. Right now the primary group of the specified user is always used. That's the most common case anyway. In the future we can extend the --owner option to allow a group after a colon. [I added this before realizing that this will not be enough to be used for user runtime directory. But this seems useful on its own, so I'm keeping this commit.]
2017-12-15logind: use free_and_replace in one spotZbigniew Jędrzejewski-Szmek1-3/+1
No functional change.
2017-12-15tree-wide: use SPECIAL_ROOT_SLICEZbigniew Jędrzejewski-Szmek4-17/+21
2017-12-15core: reuse slice_build_parent_sliceZbigniew Jędrzejewski-Szmek1-14/+8
2017-12-15logind: fix misleading messageZbigniew Jędrzejewski-Szmek1-1/+1
This message would also be emitted at boot for any user with linger enabled, so "logged in" is the wrong term to use.
2017-12-15logind: simplify one conditionalZbigniew Jędrzejewski-Szmek1-9/+6
Don't bother with removing the directory if we didn't create it.
2017-12-15tree-wide: add DEBUG_LOGGING macro that checks whether debug logging is on ↵Lennart Poettering12-11/+13
(#7645) This makes things a bit easier to read I think, and also makes sure we always use the _unlikely_ wrapper around it, which so far we used sometimes and other times we didn't. Let's clean that up.
2017-12-15Merge pull request #7637 from yuwata/transient-pathLennart Poettering5-8/+154
core/path: implement transient path unit