summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* core: call watchdog_ping() unconditionallyFranck Bui2021-09-152-42/+7
| | | | | | | | | | | | | | | | This basically reverts commit 61927b9f116bf45bfdbf19dc2981d4a4f527ae5f and relies on the fact that watchdog_ping() will open and setup the watchdog for us in case the device appears later on. Also unlike what is said in comment https://github.com/systemd/systemd/pull/17460#pullrequestreview-517434377, both m->watchdog[] and m->overriden_watchdog[] are not supposed to store the actual timeout used by the watchdog device but stores the value defined by the user. If the HW timeout value is really needed by the manager then it's probably better to read it via an helper defined in watchdog.c instead. However the HW timeout value is currently only needed by the watchdog code itself mainly when it calculates the time for the next ping.
* watchdog: make watchdog_ping() a NOP when the watchdog is disabled or closedFranck Bui2021-09-152-5/+22
| | | | | | | | This patch allows watchdog_ping() to be used unconditionally regardless of whether watchdog_set_timeout() or watchdog_close() has been previously called or not and in both cases watchdog_ping() does nothing. shutdown.c has been updated to cope with this change.
* core: watchdog_runtimeout_wait() already returns USEC_INFINITY when the ↵Franck Bui2021-09-141-7/+2
| | | | watchdog is disabled or closed
* main: use timestamp_is_set() in become_shutdown()Franck Bui2021-09-141-8/+5
|
* id128: clarify that the "well-known" IDs are about GPT partition typesLennart Poettering2021-09-102-4/+6
| | | | | At least for now they are all GPT partition types, and we should mention that.
* sd-boot: Support installing new devicetreeEmil Renner Berthing2021-09-105-1/+200
| | | | | | | | | The Bootloader Specification says "devicetree refers to the binary device tree to use when executing the kernel..", but systemd-boot didn't actually do anything when encountering this stanza until now. Add support for loading, applying fixups if relevant, and installing the new device tree before executing the kernel.
* basic/linux: Sync if_arp.h with Linux 5.14Chris Packham2021-09-101-0/+1
| | | | | | ARPHRD_MCTP was added in 5.14. Sync if_arp.h to pick up the definition Fixes #20694
* shared: Extract common LogControl CLI code to verb-log-control.hDaan De Meyer2021-09-106-168/+86
| | | | | Let's reduce duplication by sharing common logic between all log-target/log-level verbs.
* Merge pull request #20693 from mcatanzaro/mcatanzaro/nss-buffersYu Watanabe2021-09-102-38/+172
|\ | | | | nss-systemd: ensure returned strings point into provided buffer
| * nss-systemd: ensure returned strings point into provided bufferMichael Catanzaro2021-09-091-36/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jamie Bainbridge found an issue where glib's g_get_user_database_entry() may crash after doing: ``` error = getpwnam_r (logname, &pwd, buffer, bufsize, &pw); // ... pw->pw_name[0] = g_ascii_toupper (pw->pw_name[0]); ``` in order to uppercase the first letter of the user's real name. This is a glib bug, because there is a different codepath that gets the pwd from vanilla getpwnam instead of getpwnam_r as shown here. When the pwd struct is returned by getpwnam, its fields point to static data owned by glibc/NSS, and so it must not be modified by the caller. After much debugging, Jamie Bainbridge has fixed this in https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2244 by making a copy of the data before modifying it, and that resolves all problems for glib. Yay! However, glib is crashing even when getpwnam_r is used instead of getpwnam! According to getpwnam_r(3), the strings in the pwd struct are supposed to be pointers into the buffer passed by the caller, so glib should be able to safely edit it directly in this case, so long as it doesn't try to increase the size of any of the strings. Problem is various functions throughout nss-systemd.c return synthesized records declared at the top of the file. These records are returned directly and so contain pointers to static strings owned by libsystemd-nss. systemd must instead copy all the strings into the provided buffer. This crash is reproducible if nss-systemd is listed first on the passwd line in /etc/nsswitch.conf, and the application looks up one of the synthesized user accounts "root" or "nobody", and finally the application attempts to edit one of the strings in the returned struct. All our synthesized records for the other struct types have the same problem, so this commit fixes them all at once. Fixes #20679
| * nss-systemd: pack pw_passwd result into supplied bufferMichael Catanzaro2021-09-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getpwnam_r() guarantees that the strings in the struct passwd that it returns are pointers into the buffer allocated by the application and passed to getpwnam_r(). This means applications may choose to modify the strings in place, as long as the length of the strings is not increased. So it's wrong for us to return a static string here, we really do have to copy it into the application-provided buffer like we do for all the other strings. This is only a theoretical problem since it would be very weird for an application to modify the pw_passwd field, but I spotted this when investigating a similar crash caused by glib editing a different field. See also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2244
* | cryptsetup-tokens: fix typo in tpm2 token dump outputAnssi Hannula2021-09-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | cryptsetup_token_dump() gets called when the user calls "cryptsetup luksDump" for a volume and it prints the token-specific data. The tpm2 cryptsetup_token_dump() function misspells tpm2 as tmp2 on two lines of its output. Fix that.
* | Merge pull request #20681 from weblate/weblate-systemd-masterZbigniew Jędrzejewski-Szmek2021-09-093-159/+119
|\ \ | | | | | | Translations update from Weblate
| * | po: Translated using Weblate (Finnish)Jan Kuparinen2021-09-091-22/+38
| | | | | | | | | | | | | | | | | | | | | | | | Currently translated at 64.5% (122 of 189 strings) Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com> Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/ Translation: systemd/main
| * | po: Translated using Weblate (Japanese)Takuro Onoue2021-09-091-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | Currently translated at 100.0% (189 of 189 strings) Co-authored-by: Takuro Onoue <kusanaginoturugi@gmail.com> Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ja/ Translation: systemd/main
| * | po: Translated using Weblate (Indonesian)Andika Triwidada2021-09-091-126/+67
|/ / | | | | | | | | | | | | | | Currently translated at 90.4% (171 of 189 strings) Co-authored-by: Andika Triwidada <andika@gmail.com> Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/id/ Translation: systemd/main
* | analyze: ignore dependencies with security --offlineLuca Boccassi2021-09-081-0/+1
|/ | | | | We don't care about validating dependencies here, the security verb is only checking the unit(s) under test.
* sd-event: take ref on event loop object before dispatching event sourcesMichal Sekletar2021-09-091-1/+1
| | | | | | | | Idea is that all public APIs should take reference on objects that get exposed to user-provided callbacks. We take the reference as a protection from callbacks dropping it. We used to do this also here in sd_event_loop(). However, in cleanup portion of f814c871e6 this was accidentally dropped.
* core: fix free undefined pointer when strdup failed in the first loopxujing2021-09-081-2/+2
|
* test: rename `dracut_install` to `image_install`Frantisek Sumsal2021-09-084-34/+34
| | | | | | The `dracut_install` is a misnomer, since the systemd integration test suite is based on the original dracut's test suite, and not all the references to dracut has been edited out. Let's fix that.
* explicitly close FIDO2 devicespedro martelletto2021-09-082-1/+6
| | | | | | | FIDO2 device access is serialised by libfido2 using flock(). Therefore, make sure to close a FIDO2 device once we are done with it, or we risk opening it again at a later point and deadlocking. Fixes #20664.
* Merge pull request #20667 from keszybz/portable-docsLuca Boccassi2021-09-081-68/+68
|\ | | | | Tweaks to documentation about portable services
| * docs: polish the text about Portable Services a bitZbigniew Jędrzejewski-Szmek2021-09-081-64/+64
| | | | | | | | | | No semantic changes, just removal of repetitions and unnecessary words, and some more formatting.
| * docs: portablectl is in bin/Zbigniew Jędrzejewski-Szmek2021-09-081-4/+4
| | | | | | | | Follow-up for 80f39b81f3876ed3816061f1093db991f72269ec.
* | test: rename TEST-63-ANALYZE to solve conflictLuca Boccassi2021-09-084-0/+7
|/ | | | | Two PRs adding TEST-63-* were merged more or less at the same time, and we missed the conflict.
* test: udev storage testsFrantisek Sumsal2021-09-084-0/+247
|
* network: fix wrong flag: manage_foreign_routes -> manage_foreign_rulesYu Watanabe2021-09-071-1/+1
| | | | Fixes a bug in d94dfe7053d49fa62c4bfc07b7f3fc2227c10aff.
* Merge pull request #20618 from yuwata/path-find-componentLennart Poettering2021-09-074-59/+111
|\ | | | | use path_find_{first,last}_component() at more several places
| * test: do not try to remove /devYu Watanabe2021-09-071-1/+1
| |
| * fs-util: rewrite rmdir_parents() with path_find_last_component()Yu Watanabe2021-09-072-31/+75
| |
| * mkdir: rewrite mkdir_parents() with path_find_{first,last}_component()Yu Watanabe2021-09-071-27/+35
|/
* Merge pull request #20465 from bluca/portable_validate_sysextLennart Poettering2021-09-064-73/+184
|\ | | | | portabled: validate SYSEXT_LEVEL when attaching
| * portabled: refactor extraction/validation into a common helperLuca Boccassi2021-09-061-77/+92
| |
| * portabled: validate SYSEXT_LEVEL when attachingLuca Boccassi2021-09-062-18/+71
| | | | | | | | | | | | When attaching a portable service with extensions, immediately validate that the os-release and extension-release metadata values match, rather than letting it fail when the units are started
| * portabled: error out if there are no units only after parsing all imagesLuca Boccassi2021-09-061-3/+26
| | | | | | | | | | It's ok if the OS image doesn't have matching units, if we find them in the extensions. Tidies up the parsing logic a bit.
| * dissect-image: add extension-specific validation flagLuca Boccassi2021-09-063-19/+39
| | | | | | | | Allows callers to specify which image type they are looking for
* | Merge pull request #20527 from systemd/wip/hadess/usb-analysers-uaccessLennart Poettering2021-09-065-0/+39
|\ \ | | | | | | hwdb: Allow end-users root-less access to USB analysers
| * | hwdb: Allow end-users root-less access to USB analyzerswip/hadess/usb-analysers-uaccessBastien Nocera2021-09-024-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Procotol analyzers are external devices used to capture traffic over a wire so that it could be analysed. End-users at the console should be able to access those devices without requiring root access. This change obsoletes the need to install Total Phase's "Linux drivers", which are really just udev rules and hotplug usermap files to do that: https://www.totalphase.com/products/usb-drivers-linux/
| * | udev: Import hwdb matches for USB devicesBastien Nocera2021-09-011-0/+1
| | | | | | | | | | | | | | | | | | Import hwdb matches for USB devices (not interfaces) which don't usually have a modalias so that it's possible to, for example, make them available for unprivileged users.
* | | systemd-analyze: add new option to generate JSON output of security analysis ↵Maanya Goenka2021-09-068-35/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | table The new option --json= works with the 'security' verb and takes in one of three format flags. These are off which is the default, pretty and short which use JSON format flags for output. When set to true, it generates a JSON formatted output of the security analysis table. The format is a JSON array with objects containing the following fields: set which indicates if the id has been set or not, name which is what is used to refer to the id, json_field which is the equivalent JSON formatted id name only used for JSON outputs, description which is an outline of the id state, and exposure which is an unsigned integer in the range 0.0..10.0, where a higher value corresponds to a higher security threat. The JSON version of the table is printed on the standard output file. Example Run: The unit file testfile.service was created to test the --json= option maanya-goenka@debian:~/systemd (json-security)$ cat <<EOF >testfile.service > [Service] > ExecStart = echo hello > PrivateNetwork = yes > PrivateMounts = yes > PrivateDevices = yes > EOF Both the JSON output and the security analysis table below have been truncated to increase readability. 1. Testing for when --json=off maanya-goenka@debian:~/systemd (json-security)$ sudo build/systemd-analyze security --json=off --root= --offline=true testfile.service --no-pager /usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed. /usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly. /usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether. /home/maanya-goenka/systemd/foo.service:2: Unknown key name 'foo' in section 'Unit', ignoring. NAME DESCRIPTION EXPOSURE ✓ PrivateNetwork= Service has no access to the host's network ✗ User=/DynamicUser= Service runs as root user 0.4 ✗ CapabilityBoundingSet=~CAP_SET(UID|GID|PCAP) Service may change UID/GID identities/capabilities 0.3 ✗ CapabilityBoundingSet=~CAP_NET_ADMIN Service has administrator privileges 0.3 → Overall exposure level for testfile.service: 8.3 EXPOSED 🙁 2. Testing for when --json=pretty maanya-goenka@debian:~/systemd (json-security)$ sudo build/systemd-analyze security --json=pretty --root= --offline=true testfile.service /usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed. /usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly. /usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether. /home/maanya-goenka/systemd/foo.service:2: Unknown key name 'foo' in section 'Unit', ignoring. [ { "set" : true, "name" : "PrivateNetwork=", "json-field" : "PrivateNetwork", "description" : "Service has no access to the host's network", "exposure" : null }, { "set" : false, "name" : "User=/DynamicUser=", "json-field" : "UserOrDynamicUser", "decsription" : "Service runs as root user", "exposure" : "0.4" }, { "set" : false, "name" : "CapabilityBoundingSet=~CAP_SET(UID|GID|PCAP)", "json_field" : "CapabilityBoundingSet_CAP_SET_UID_GID_PCAP", "description" : "Service may change UID/GID identities/capabilities", "exposure" : "0.3" }, { "set" : false, "name" : "CapabilityBoundingSet=~CAP_NET_ADMIN", "json_field" : "CapabilityBoundingSet_CAP_NET_ADMIN", "description" : "Service has administrator privileges", "exposure" : "0.3" }, ... ] 3. Testing for when --json=short maanya-goenka@debian:~/systemd (json-security)$ sudo build/systemd-analyze security --json=short --root= --offline=true testfile.service /usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed. /usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly. /usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether. /home/maanya-goenka/systemd/foo.service:2: Unknown key name 'foo' in section 'Unit', ignoring. [{"set":true,"name":"PrivateNetwork=", "json_field":"PrivateNetwork", "description":"Service has no access to the host's network","exposure":null}, ...]
* | | systemd-analyze: use config value in RestrictNamespaces id (#20645)Kyle Laker2021-09-063-28/+28
| | | | | | | | | | | | | | | | | | For most fields, the text shown by `.id` is the value that should be set in the unit file; however, for RestrictNamespaces, it is not. Changing this to show the actual text makes it more clear to a user what the actual change that needs to be made to the unit file is.
* | | Fix volume control keys for LG Gram (#20644)Ross Jennings2021-09-061-0/+9
| |/ |/| | | | | Fix volume control keys for LG Gram
* | Fix esc, volume control keys and Fn+F1 for Samsung Galaxy Booklainahai2021-09-051-0/+8
| |
* | Fix volume control keys for Lenovo Ideapad Flex 5saikat05112021-09-051-0/+5
| | | | | | Fixes the keys not creating release events
* | tmpfiles: minor modernizationYu Watanabe2021-09-051-20/+6
| |
* | home: 'secret' argument of handle_generic_user_record_error may be nullYu Watanabe2021-09-051-1/+18
| | | | | | | | | | | | When RefHome() bus method is called in acquire_home(), secret is NULL. Fixes #20639.
* | tree-wide: fix typoYu Watanabe2021-09-055-5/+5
| |
* | Merge pull request #20626 from yuwata/network-keep-masterLuca Boccassi2021-09-0411-54/+197
|\ \ | | | | | | network: introduce KeepMaster= setting
| * | network: add 80-container-vb.networkYu Watanabe2021-09-041-0/+22
| | |
| * | test-network: add tests for KeepMaster=Yu Watanabe2021-09-042-0/+72
| | |