summaryrefslogtreecommitdiff
path: root/src/shared
Commit message (Collapse)AuthorAgeFilesLines
...
| * | shared/json: allow json_variant_dump() to return an errorZbigniew Jędrzejewski-Szmek2022-10-182-4/+5
| |/
* | tree-wide: set description for device managerYu Watanabe2022-10-191-0/+9
|/
* Merge pull request #25036 from keszybz/pluralsLuca Boccassi2022-10-173-4/+4
|\ | | | | Remove usage of "noun(s)" in messages and docs
| * tree-wide: replace "plural(s)" by "plurals"Zbigniew Jędrzejewski-Szmek2022-10-173-4/+4
| | | | | | | | | | | | | | | | (s) is just ugly with a vibe of DOS. In most cases just using the normal plural form is more natural and gramatically correct. There are some log_debug() statements left, and texts in foreign licenses or headers. Those are not touched on purpose.
* | Merge pull request #24919 from anitazha/varlinkserializeZbigniew Jędrzejewski-Szmek2022-10-174-12/+156
|\ \ | | | | | | varlink/pid1 fixes for systemd-oomd (addresses #20330)
| * | core: only allow systemd-oomd to use SubscribeManagedOOMCGroupsAnita Zhang2022-10-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Attempt to address https://github.com/systemd/systemd/issues/20330#issuecomment-1210028422. Summary of the comment: Unprivileged users can potentially cause a denial of service during systemd-oomd unit subscriptions by spamming requests to SubscribeManagedOOMCGroups. As systemd-oomd.service is the only unit that should be accessing this method, add a check on the caller's unit name to deter them from successfully using this method.
| * | core: serialize/deserialize varlink sockets for pid1Anita Zhang2022-10-143-0/+94
| | | | | | | | | | | | Fixes #20330
| * | varlink: refactor adding socket event source to the event loopAnita Zhang2022-10-141-7/+24
| | |
| * | varlink: set address field in VarlinkServerSocketAnita Zhang2022-10-111-5/+37
| | |
* | | qrcode-util: Add support for libqrencode 3.0Daan De Meyer2022-10-171-2/+11
| | | | | | | | | | | | | | | | | | They didn't actually change API between major versions, so let's support the previous version as well so we can add CentOS 8 Stream back to CI.
* | | generator: modernize generator_open_unit_file()Lennart Poettering2022-10-171-14/+16
| | |
* | | tpm2-util: fix parameter nameLennart Poettering2022-10-171-1/+1
| | |
* | | seccomp: add riscv_flush_icache to allow listCeleste Liu2022-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This system call is harmless because it only enforces ordering between stores and instruction cache fetch. fixed #24991 Related: https://github.com/felixonmars/archriscv-packages/issues/1840 Signed-off-by: Celeste Liu <CoelacanthusHex@gmail.com>
* | | seccomp: drop per arch conditionalization in filter groupsLennart Poettering2022-10-151-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We list plenty of arch-specific syscalls in our filter groups, treat the s390 syscalls the same. We handle gracefully anyway if some syscall doesn't exist locally on the kernel or arch, let's rely on it. This has the benefit that "systemd-analyze" will comprehensively tell you the syscalls filtered on any arch for any arch. And less conditionalization is good anyway.
* | | Merge pull request #25002 from poettering/install-type-fixLuca Boccassi2022-10-143-46/+47
|\ \ \ | |_|/ |/| | install: make InstallChangeType enum a proper enum
| * | install: include full type name in special UnitFilePresetMode valuesLennart Poettering2022-10-142-5/+5
| | | | | | | | | | | | | | | | | | Typically the _MAX and _INVALID special enum values use the full type as prefix, even if the actual values of the enum might not. Let's follow this rule here too.
| * | install: make InstallChange enum type a proper typeLennart Poettering2022-10-143-41/+42
| | | | | | | | | | | | | | | | | | | | | We can just make this an enum, as long as we ensure it has enough range, which we can do by adding -ERRNO_MAX as one possible value (at least on GNU C). We already do that at multiple other places, so let's do this here too.
* | | elf-util: drop assertion for metadata in report_module_metadata()Yu Watanabe2022-10-141-16/+17
| | | | | | | | | | | | | | | | | | Fixes a bug introduced by 1a0281a3ebf4f8c16d40aa9e63103f16cd23bb2a. Fixes RHBZ#2134741 (https://bugzilla.redhat.com/show_bug.cgi?id=2134741).
* | | shared/logs-show: do not overwrite journal time in export format with source ↵msizanoen12022-10-141-18/+26
|/ / | | | | | | | | | | | | | | | | | | | | | | | | timestamps Using _SOURCE_{MONOTONIC,REALTIME}_TIMESTAMP in place of the results of sd_journal_get_{monotonic,realtime}_usecs in export formats might cause internal inconsistency of realtime timestamp values within a journal export, violating the export file format and causing systemd-journal-remote to mass-generate journal files. Fix this by using the real journal timestamps for __{REALTIME,MONOTONIC}_TIMESTAMP.
* | shared/install: print warning when unmasking unit with cmdline maskZbigniew Jędrzejewski-Szmek2022-10-132-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'systemctl unmask foo' will try to remove the symlink to /dev/null under /etc/. But the unit may also be masked by a symlink under /run/generator, in particular the one created by systemd-debug-generator based on systemd.mask=foo on the kernel commandline. The unmask call cannot anything about this: even if it removed the symlink from /run/generator, it'll be recreated on the next daemon-reload. Thus, we can only warn about it. Initially, I wanted to check if 'systemctl.mask' is defined on the kernel command-line, but that's not effective, because such mask symlinks can be created by other generators based on other conditions. Checking for runtime mask is "dumber", but is more robust because it doesn't assume who created the mask and why. The handling of InstallInfo is the copied from install_info_symlink_wants(). It's pretty ugly, this whole code should be rewritten from scratch. The message is printed, but the whole operation is still "successful". This keep backwards compatibility: people might call unmask to remove filesystem masks even if there's still a cmdline param in place. We allow 'systemctl mask' to create such a mask, so 'unmask' should be able to remove it. Fixes #22689.
* | shared/install: use cleanup func for InstallInfo*Zbigniew Jędrzejewski-Szmek2022-10-131-50/+40
| | | | | | | | | | In the next commit cleanup will be used in one more place. This change avoids proliferation of the open-coded cleanup calls.
* | shared/install: rename 'UnitFileInstallInfo' to 'InstallInfo'Zbigniew Jędrzejewski-Szmek2022-10-134-54/+54
| | | | | | | | | | | | | | - shorter is better - name now matches the defining-file name I was also considering UnitInstallInfo. Can change if people prefer that.
* | shared/install: rename 'unit_file_change_type' to 'install_change' + followupsZbigniew Jędrzejewski-Szmek2022-10-133-61/+63
| | | | | | | | | | | | We had an anonymous enum with values called UNIT_FILE_…, which could easily be confused with UNIT_FILE_… from UnitFileFlags enum. This commit renames the enum values and also the variables which refer to them.
* | shared/install: rename UnitFileInstallInfo.type to .install_modeZbigniew Jędrzejewski-Szmek2022-10-132-30/+31
| |
* | shared/install: rename 'unit file type' to 'install mode'Zbigniew Jędrzejewski-Szmek2022-10-132-45/+45
| | | | | | | | | | git grep -l -nwi 'UnitFileType|UNIT_FILE_TYPE' | \ xargs sed -r -i 's/UnitFileType/InstallMode/g; s/UNIT_FILE_TYPE/INSTALL_MODE/g; s/unit_file_type/install_mode/g'
* | shared/install: rename UnitFileChange to InstallChangeZbigniew Jędrzejewski-Szmek2022-10-134-95/+95
| | | | | | | | | | It's shorter and more generic. The struct can contain info about changes to unit files, but also symlinks and errors.
* | shared/install: rename 'files' param to 'names'Zbigniew Jędrzejewski-Szmek2022-10-132-55/+58
| | | | | | | | | | … or 'name_or_path' or 'names_or_paths' as appropriate. Those functions are generally called with unit names as arguments.
* | dissect-image: introduce probe_filesystem_full() which can take file ↵Yu Watanabe2022-10-132-12/+40
| | | | | | | | | | | | | | descriptor of device node In dissect_loop_device(), we have opened the device node. Let's reuse the file descriptor.
* | dissect-image: open dissected or decrypted partitions and mount through the ↵Yu Watanabe2022-10-132-6/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | file descriptor If multiple services with the same encrypted image are simultaneously starting, one may deactivate the dm device while others using it. Or, similary, after (regular) partitions are dissected, another process may try to remove them before we mount them. To prevent such situations, let's keep the dissected and decrypted partitions opened. Then, use the file descriptors when we mount the partitions. Fixes #24617.
* | dissect-image: try to open device node before activatingYu Watanabe2022-10-131-1/+11
| | | | | | | | | | Hopefully decrease the chance that the device is removed soon after it is detected.
* | dissect-image: fix error handling of @cancel_deferred_remove DM commandYu Watanabe2022-10-131-7/+10
| | | | | | | | | | See target_message() in drivers/md/dm-ioctl.c and dm_cancel_deferred_remove() in drivers/md/dm.c.
* | dissect-image: reduce indentationYu Watanabe2022-10-131-39/+48
| | | | | | | | No functional change, just refactoring.
* | Merge pull request #24883 from bluca/extrel_forceLuca Boccassi2022-10-124-6/+22
|\ \ | | | | | | portable: allow caller to override extension-release name check
| * | portable: allow caller to override extension-release name checkLuca Boccassi2022-10-123-5/+19
| | | | | | | | | | | | | | | When the --force flag is used, do not insist that the extension-release file has to match the extension image name
| * | mount-util: do not pass 'x-*' options to mount syscallLuca Boccassi2022-10-121-1/+3
| | | | | | | | | | | | They will not be recognized. libmount filters them manually.
* | | Merge pull request #24934 from keszybz/remove-nss-lookupLuca Boccassi2022-10-121-9/+14
|\ \ \ | |/ / |/| | Remove nss lookups from pid1
| * | shared/condition: avoid nss lookup in PID1Zbigniew Jędrzejewski-Szmek2022-10-121-9/+14
| |/ | | | | | | | | | | | | | | | | | | PID 1 is not allowed to do nss lookups because this may take a long time or even deadlock. While at it, the comparisons are reordered to do the "easy" comparisons which only require a string comparison first. Delay parsing of the UID until it is really necessary. The result is the same, because we know that "root" and "nobody" parse as valid.
* | Merge pull request #24970 from DaanDeMeyer/crypsetup-fixLennart Poettering2022-10-122-59/+63
|\ \ | | | | | | Cryptsetup compilation fixes
| * | cryptsetup-util: Always define dlopen_cryptsetup()Daan De Meyer2022-10-112-59/+63
| | |
* | | Merge pull request #24933 from keszybz/erradicate-strerrorLuca Boccassi2022-10-113-34/+64
|\ \ \ | | | | | | | | Erradicate strerror
| * | | shared/journal-importer: use %m instead of strerror()Zbigniew Jędrzejewski-Szmek2022-10-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here SYNTHETIC_ERRNO() was used based on the general rule that logging functions should do that when the error value is generated at the call site. But here we're really propagating a memory allocation error, which wasn't reported using errno, but the meaning is the same. And it's better to bend the rule a bit like this than to use strerror().
| * | | shared/pam-util: add pam_syslog_pam_error() wrapperZbigniew Jędrzejewski-Szmek2022-10-112-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a primitive helper that wraps calls to pam_syslog() replacing @PAMERR@ with pam_strerror() output in the format string. This allows for a bunch of boilerplate to be removed. @PAMERR@ is only supported at the end of the string. Similarly to %m, realistically that's the only place where it is useful. Note that unlike in logging functions in log.[ch], here the error value is only used for the message and is not saved anywhere, so we don't need to care about SYNTHETIC_ERRNO.
| * | | shared/pam-util: add pam_syslog_errno() wrapper that sets errnoZbigniew Jędrzejewski-Szmek2022-10-102-21/+26
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far our pam code was using strerror_safe(). But that's not a good approach, because strerror_safe() is not thread-safe, and the pam code is "library code" that should be thread-safe. In fact, the whole effort to use strerror() is unnecessary, because pam_syslog() is documented to support %m. The implementation in linux-pam simply uses vasprintf(). If we use %m too, we get rid of the issue. The wrapper sets errno temporarily from the argument. Apparently some PAM consumers run multiple PAM stacks in threads, so we should avoid non-thread-safe code. The new helper returns PAM_BUF_ERR for ENOMEM, and PAM_SERVICE_ERR in other cases. This may change the returned code in some cases, but I think a) it doesn't matter much, b) it's probably for the better. E.g. we might now return PAM_SERVICE_ERR if the dbus message is borked, and PAM_SERVICE_ERR seems appropriate.
* | | Merge pull request #24968 from poettering/logs-show-timestamp-fixLuca Boccassi2022-10-111-10/+17
|\ \ \ | | | | | | | | logs-show timestamp fix
| * | | logs-show: be more careful when initializing get_dual_timestamp() return ↵Lennart Poettering2022-10-111-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parameters make sure we always have something to return in all return parameters, including in the boot id return parameter, in all code paths. Follow-up for: #24965
| * | | sd-journal: exit loop once we got all fields we are interested inLennart Poettering2022-10-111-0/+3
| | |/ | |/|
* | | logind: do not emit beep in wall messagesZbigniew Jędrzejewski-Szmek2022-10-111-1/+1
|/ / | | | | | | | | | | | | | | Those may go via the PC speaker, which is annoying and unexpected. Most people have it off, so this doesn't work reliably anyway, so we can disable it without much loss. Fixes #23520.
* | logs-show: Always retrieve the boot ID from the entryDaan De Meyer2022-10-111-2/+4
| | | | | | | | | | | | | | If _SOURCE_MONOTONIC_TIMESTAMP was set in the entry, we wouldn't query the boot ID, leading to every kernel entry in the export mode to have BOOT_ID=000000000000000. Let's fix this by always querying the boot ID.
* | tree-wide: add ERRNO_IS_XATTR_ABSENT() helperLennart Poettering2022-10-103-5/+5
| | | | | | | | | | We check the same list of error codes on various xattr operations, and we should on some more. Add a common helper for this purpose.
* | Revert "journal: Add --convert= command to journalctl"Daan De Meyer2022-10-082-53/+0
| | | | | | | | | | | | This reverts commit 721620e8a32907ffe546a582c5ac7136b6367510. This commit was accidentally merged as part of #22998