summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Prep v233: Add missing files from upstream and rename formats-util.[hc]Sven Eden2017-07-17
| | | | | | | | | | | | | | | | Some functionality has been exported to the following files: - src/basic/env-util.[hc] - src/basic/exec-util.[hc] - src/shared/nsflags.[hc] The content of these files is now needed in elogind, and the files have been added as-is. Cleanup is done later. Further the header src/basic/formats-util.h has been renamed to src/basic/format-util.h
* Prep v233: Update root build files to upstream versionSven Eden2017-07-17
|
* Revert "util: Fine tune running_in_chroot() a bit" (#5506)Lennart Poettering2017-07-17
| | | | | | | | | | | This reverts commit 295ee9845c801300298d01256eb5a9e3ff117ae0. Let'd revert this for now, see #5446 for discussions. We want elogind-detect-virt --chroot to return true for all chroot-like stuff, for example mock environments which have use a mount namespace. The downside of this revert that systemctl will not work from our own namespaced services, anything with RootDirectory=/RootImage= set.
* mount-util: accept that name_to_handle_at() might fail with EPERM (#5499)Lennart Poettering2017-07-17
| | | | | | | | | | | | | Container managers frequently block name_to_handle_at(), returning EACCES or EPERM when this is issued. Accept that, and simply fall back to to fdinfo-based checks. Note that we accept either EACCES or EPERM here, as container managers can choose the error code and aren't very good on agreeing on just one. (note that this is a non-issue with nspawn, as we permit name_to_handle_at() there, only block open_by_handle_at(), which should be sufficiently safe).
* socket-util: introduce address_label_validSusant Sahani2017-07-17
|
* Fix missing space in comments (#5439)AsciiWolf2017-07-17
|
* cgroup: rework cg_all_unified()Lennart Poettering2017-07-17
| | | | | | | | Let's just check the unified level, directly. There's really no value in wrapping cg_unified_controllers() with this, i.e. potentially do string comparison when there's no reason to. Also, this makes the clal more alike cg_hybrid_unified().
* cgroup: rename cg_update_unified() → cg_unified_update()Lennart Poettering2017-07-17
| | | | | We usually put the noun first, the verb (i.e. method) secont, for example in cg_unified_flush(), let's follow the logic here...
* cgroup: rename cg_unified() → cg_unified_controller()Lennart Poettering2017-07-17
| | | | | cg_unified() is a bit generic a name, let's make clear that it checks whether a specified controller is in unified mode.
* cgroup: change cg_unified() to possibly return errors againLennart Poettering2017-07-17
| | | | | | | | | We use our cgroup APIs in various contexts, including from our libraries sd-login, sd-bus. As we don#t control those environments we can't rely that the unified cgroup setup logic succeeds, and hence really shouldn't assert on it. This more or less reverts 415fc41ceaeada2e32639f24f134b1c248b9e43f.
* cgroup-util: check unified_cache before invoking streq()Lennart Poettering2017-07-17
| | | | Just a minor optimization.
* cgroup-util: fix the case of default=unified, unified-cgroup-hierarchy=0Zbigniew Jędrzejewski-Szmek2017-07-17
| | | | | We should mount the hybrid hierarchy if the user disabled the unified hierarchy on the kernel command line.
* cgroup-util: cache all cg_is_*_wanted answers, disable ↵Zbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | /sys/fs/cgroups/unified on unified If we encounter an error in proc cmdline parsing, just treat that as permanent, i.e. the same as if the option was not specified. Realistically, it is better to use the same condition for all related mounts, then to have e.g. /sys/fs/cgroup mounted and /sys/fs/cgroup/unified not. If we find something is mounted and base our answer on that, cache that result too. Fix the conditions so that if "unified" is used, make sure any "hybrid" mounts are not mounted.
* Fix check for signal in set (#5416)stuart-mclaren2017-07-17
| | | | | | | IN_SET(SIGCONT, SIGKILL) will always evaluate to false. The signal needs to be included as the first argument. Fixup for 26f417d3e8dd2522adfdc4c8fed4c36fa40f48fc.
* Revert "basic/strv: allow NULLs to be inserted into strv"Lennart Poettering2017-07-17
| | | | | | | | This reverts commit 18f71a3c8174774c5386c4aba94d54f3b5c36a84. According to @keszybz we don't need this anymore, hence drop it: https://github.com/elogind/elogind/pull/5131/commits/18f71a3c8174774c5386c4aba94d54f3b5c36a84#r102232368
* log: never log into foreign fd #2 in PID 1 or its pre-execve() childrenLennart Poettering2017-07-17
| | | | Fixes: #5401
* bootctl: create loader.conf only if it doesn't exist yetLennart Poettering2017-07-17
| | | | | | | | | If the snippet aleady exists, don't do anything, as the file was already installed then. (This also reworks the code to create the file atomically) Fixes: #5396
* basic/fileio: use IN_SETZbigniew Jędrzejewski-Szmek2017-07-17
|
* basic/fileio: fix memleak when discarding an invalid variableZbigniew Jędrzejewski-Szmek2017-07-17
| | | | Fixes #5405.
* copy: a plain unlink() works here tooLennart Poettering2017-07-17
|
* Syntax for defines that is also unterstood by the GNU C/C++ compilers. (#5397)pyBlob2017-07-17
|
* cgroup-util: fix the reversed return value of ↵Zbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | cg_is_unified_elogind_contoller_wanted 1d84ad944520fc3e062ef518c4db4e1 reversed the meaning of the option. The kernel command line option has the opposite meaning to the function, i.e. specifying "legacy=yes" means "unifed elogind controller=no".
* core/mount-setup: if unified hierarchy is not supported, fall back to legacyZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | We need this to gracefully support older or strangely configured kernels. v2: - do not install a callback handler, just embed the right conditions into cg_is_*_wanted() v3: - fix bug in cg_is_legacy_wanted()
* Rename cg_is_unified_elogind_controller_wanted to cg_is_hybrid_wantedZbigniew Jędrzejewski-Szmek2017-07-17
| | | | Less typing and doesn't make the table so incredibly wide.
* shared/pager: abort if we cannot set environment variablesZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | This most likely means oom, it's better to exit than to run less with incomplete settings. CID #714383.
* logind: check return value from lseekZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | In practice this doesn't matter much because the read that follows will likely fail, but we'll get a better error message. CID #1368233.
* build.h: include default cgroup hierarchy setting in --version outputZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | This is pretty important, and we print this string during startup, so putting the default hierarchy information might help with diagnosis if things go awry. $ ./systemctl --version elogind 232 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN default-hierarchy=legacy v2: make the message nicer by including the ./configure option argument directly in output
* pid1: add ./configure switch to select default cgroup hierarchyZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | | | The default default is set to "legacy", with "hybrid" and "unified" being the other two alternatives. There invert the behaviour for elogind.legacy_elogind_cgroup_controller: if it is not specified on the kernel command line, "hybrid" is used if selected as the default. If this option is specified, "hybrid" is used if false, and full "legacy" if true. Also make all fields in the configure summary lowercase (unless they are capitalized names) for consistency. v2: - update for the fixed interpreation of elogind.legacy_elogind_cgroup_controller
* Tighten checking for variable validityZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | In the future we might want to allow additional syntax (for example "unset VAR". But let's check that the data we're getting does not contain anything unexpected.
* missing: add renameat2() definition for 64bit arm (#5378)Lennart Poettering2017-07-17
| | | | | | Following a similar commit in casync: https://github.com/elogind/casync/pull/10
* virt: Update cache if the detected vm is virtualbox (#5364)Benjamin Robin2017-07-17
|
* hostname-util: default to the compile time default hostname in ↵Lennart Poettering2017-07-17
| | | | | | | | | gethostname_malloc() Currently, if the hostname is not set gethostname_malloc() defaults to the "sysname", which is "linux" on Linux. Let's change that to also honour the compile-time fallback hostname as specified on the configure command line.
* virt: swap order of cpuid and dmi again, but properly detect oracle (#5355)Christian Hesse2017-07-17
| | | | | | | This breaks again, this time for setups where Qemu is not reported via DMI for whatever reason. So swap order of cpuid and dmi again, but properly detect oracle. See issue #5318.
* virt: detect qemu/kvm as 'kvm'Christian Hesse2017-07-17
| | | | | | | | | | In commit 050e65a we swapped order of detect_vm_{cpuid,dmi}(). That fixed Virtualbox but broke qemu with kvm, which is expected to return 'kvm'. So check for qemu/kvm first, then DMI, CPUID last. This fixes #5318. Signed-off-by: Christian Hesse <mail@eworm.de>
* machined: when copying files from/to userns containers chown to rootLennart Poettering2017-07-17
| | | | | | | | This changes the file copy logic of machined to set the UID/GID of all copied files to 0 if the host and container do not share the same user namespace. Fixes: #4078
* copy: change the various copy_xyz() calls to take a unified flags parameterLennart Poettering2017-07-17
| | | | | | | | This adds a unified "copy_flags" parameter to all copy_xyz() function calls, replacing the various boolean flags so far used. This should make many invocations more readable as it is clear what behaviour is precisely requested. This also prepares ground for adding support for more modes later on.
* core/manager: split out creation of serialization fd out to a helperZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | There is a slight change in behaviour: the user manager for root will create a temporary file in /run/elogind, not /tmp. I don't think this matters, but simplifies implementation.
* Allow braceless variables to be expandedZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | (Only in environment.d files.) We have only basic compatibility with shell syntax, but specifying variables without using braces is probably more common, and I think a lot of people would be surprised if this didn't work.
* env-util,fileio: immediately replace variables in load_env_file_push()Zbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | | | | | | strv_env_replace was calling env_match(), which in effect allowed multiple values for the same key to be inserted into the environment block. That's pointless, because APIs to access variables only return a single value (the latest entry), so it's better to keep the block clean, i.e. with just a single entry for each key. Add a new helper function that simply tests if the part before '=' is equal in two strings and use that in strv_env_replace. In load_env_file_push, use strv_env_replace to immediately replace the previous assignment with a matching name. Afaict, none of the callers are materially affected by this change, but it seems like some pointless work was being done, if the same value was set multiple times. We'd go through parsing and assigning the value for each entry. With this change, we handle just the last one.
* basic/fileio: add helper function for a set of two common checksZbigniew Jędrzejewski-Szmek2017-07-17
|
* man: update pam_elogind and elogind-logind man pages a bitLennart Poettering2017-07-17
| | | | | | | This builds on @utezduyar's #4640, but extends on it. Fixes: #4550 Replaces: #4640
* sd-event: "when exiting no signal event are pending" is a wrong assertion ↵Franck Bui2017-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#5271) The code make the following assertion: when freeing a event loop object (usually it's done after exiting from the main event loop), no signal events are still queued and are pending. This assertion can be found in event_unmask_signal_data() with "assert(!d->current);" assertion. It appears that this assertion can be wrong at least in a specific case described below. Consider the following example which is inspired from udev: a process defines 3 source events: 2 are created by sd_event_add_signal() and 1 is created by sd_event_add_post(). 1. the process receives the 2 signals consecutively so that signal 'A' source event is queued and pending. Consequently the post source event is also queued and pending. This is done by sd_event_wait(). 2. The callback for signal 'A' is called by sd_event_dispatch(). 3. The next call to sd_event_wait() will queue signal 'B' source event. 4. The callback for the post source event is called and calls sd_event_exit(). 5. the event loop is exited. 6. freeing the event loop object will lead to the assertion failure in event_unmask_signal_data(). This patch simply removes this assertion as it doesn't seem to be a bug if the signal data still reference a signal source at this point.
* tree-wide: make bus_map_all_properties return a proper sd_bus_errorLennart Poettering2017-07-17
| | | | | | | | And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
* basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffixZbigniew Jędrzejewski-Szmek2017-07-17
|
* l10n: fix file permissions of Indonesian translationAsciiWolf2017-07-17
|
* man: document that sd_notify() is racy in some casesLennart Poettering2017-07-17
|
* treewide: replace homegrown memory_erase with explicit_bzeroZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | explicit_bzero was added in glibc 2.25. Make use of it. explicit_bzero is hardcoded to zero the memory, so string erase now truncates the string, instead of overwriting it with 'x'. This causes a visible difference only in the journalctl case.
* time-util: Fix overflow check introduce in commit f977849 (#5216)Benjamin Robin2017-07-17
|
* manager: refuse reloading/reexecing when /run is overly fullLennart Poettering2017-07-17
| | | | | | | Let's add an extra safety check: before entering a reload/reexec, let's verify that there's enough room in /run for it. Fixes: #5016
* logind: Don't try to emit a change signal for the 'Sessions' property (#5211)afrantzis2017-07-17
| | | | | | | | | The 'Sessions' property for both org.freedesktop.login1.User and org.freedesktop.login1.Seat is marked as EmitsChangedSignal(false). Trying to emit a change signal that includes the 'Sessions' property leads to the signal not being sent at all. Fixes #5210.