]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
23 months agoinstall: make InstallChange enum type a proper type
Lennart Poettering [Fri, 14 Oct 2022 09:11:53 +0000 (11:11 +0200)] 
install: make InstallChange enum type a proper type

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.

23 months agoupdate TODO
Lennart Poettering [Fri, 14 Oct 2022 09:32:43 +0000 (11:32 +0200)] 
update TODO

23 months agoudev/rules: add by-path and by-ibdev links to infiniband verbs
Lubomir Rintel [Thu, 13 Oct 2022 11:49:22 +0000 (13:49 +0200)] 
udev/rules: add by-path and by-ibdev links to infiniband verbs

The uverbs devices are sequentially numbered and are not guarranteed to
stay stable across reboot.

At least one good person was disappointed by this, because they couldn't
find their device: https://bugzilla.redhat.com/show_bug.cgi?id=2036515

Let's add a few helpful links.

23 months agoMerge pull request #24461 from keszybz/better-unmask-message
Zbigniew Jędrzejewski-Szmek [Thu, 13 Oct 2022 21:17:49 +0000 (23:17 +0200)] 
Merge pull request #24461 from keszybz/better-unmask-message

Better unmask message when unit is masked via kernel commandline

23 months agoshared/install: print warning when unmasking unit with cmdline mask 24461/head
Zbigniew Jędrzejewski-Szmek [Fri, 26 Aug 2022 10:02:43 +0000 (12:02 +0200)] 
shared/install: print warning when unmasking unit with cmdline mask

'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.

23 months agoshared/install: use cleanup func for InstallInfo*
Zbigniew Jędrzejewski-Szmek [Mon, 29 Aug 2022 08:11:41 +0000 (10:11 +0200)] 
shared/install: use cleanup func for InstallInfo*

In the next commit cleanup will be used in one more place. This change
avoids proliferation of the open-coded cleanup calls.

23 months agoshared/install: rename 'UnitFileInstallInfo' to 'InstallInfo'
Zbigniew Jędrzejewski-Szmek [Fri, 26 Aug 2022 08:40:17 +0000 (10:40 +0200)] 
shared/install: rename 'UnitFileInstallInfo' to 'InstallInfo'

- shorter is better
- name now matches the defining-file name

I was also considering UnitInstallInfo. Can change if people prefer that.

23 months agoshared/install: rename 'unit_file_change_type' to 'install_change' + followups
Zbigniew Jędrzejewski-Szmek [Sun, 18 Sep 2022 16:00:41 +0000 (18:00 +0200)] 
shared/install: rename 'unit_file_change_type' to 'install_change' + followups

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.

23 months agoshared/install: rename UnitFileInstallInfo.type to .install_mode
Zbigniew Jędrzejewski-Szmek [Fri, 26 Aug 2022 08:11:13 +0000 (10:11 +0200)] 
shared/install: rename UnitFileInstallInfo.type to .install_mode

23 months agoshared/install: rename 'unit file type' to 'install mode'
Zbigniew Jędrzejewski-Szmek [Fri, 26 Aug 2022 07:52:59 +0000 (09:52 +0200)] 
shared/install: rename 'unit file type' to 'install mode'

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'

23 months agoshared/install: rename UnitFileChange to InstallChange
Zbigniew Jędrzejewski-Szmek [Fri, 26 Aug 2022 07:30:01 +0000 (09:30 +0200)] 
shared/install: rename UnitFileChange to InstallChange

It's shorter and more generic. The struct can contain info about changes to
unit files, but also symlinks and errors.

23 months agoshared/install: rename 'files' param to 'names'
Zbigniew Jędrzejewski-Szmek [Wed, 24 Aug 2022 15:23:40 +0000 (17:23 +0200)] 
shared/install: rename 'files' param to 'names'

… or 'name_or_path' or 'names_or_paths' as appropriate. Those functions are
generally called with unit names as arguments.

23 months agosd-journal: use new() instead of newa() if too many items will be added 24702/head
Yu Watanabe [Wed, 12 Oct 2022 06:45:55 +0000 (15:45 +0900)] 
sd-journal: use new() instead of newa() if too many items will be added

For safety, as the size may not be under our control.

23 months agoMerge pull request #24985 from yuwata/codeql
Yu Watanabe [Thu, 13 Oct 2022 12:36:16 +0000 (21:36 +0900)] 
Merge pull request #24985 from yuwata/codeql

test: several cleanups suggested by CodeQL

23 months agotest: introduce __eq__() and __ne__() 24985/head
Yu Watanabe [Thu, 13 Oct 2022 08:41:45 +0000 (17:41 +0900)] 
test: introduce __eq__() and __ne__()

Suggested by CodeQL#160 (https://github.com/systemd/systemd/security/code-scanning/160).

23 months agotest: drop unused modules
Yu Watanabe [Thu, 13 Oct 2022 08:34:08 +0000 (17:34 +0900)] 
test: drop unused modules

Suggested by CodeQL#167 (https://github.com/systemd/systemd/security/code-scanning/167)
and CodeQL#168 (https://github.com/systemd/systemd/security/code-scanning/168).

23 months agotest: improve assertion message on failure
Yu Watanabe [Thu, 13 Oct 2022 08:31:37 +0000 (17:31 +0900)] 
test: improve assertion message on failure

Suggested by CodeQL#169 (https://github.com/systemd/systemd/security/code-scanning/169).

23 months agoTODO: fix typo
Yu Watanabe [Thu, 13 Oct 2022 08:15:50 +0000 (17:15 +0900)] 
TODO: fix typo

23 months agoupdate TODO
Lennart Poettering [Thu, 13 Oct 2022 07:47:55 +0000 (09:47 +0200)] 
update TODO

23 months agoupdate NEWS
Lennart Poettering [Thu, 13 Oct 2022 07:47:48 +0000 (09:47 +0200)] 
update NEWS

23 months agoanalyze: extend the dump command to accept patterns
Franck Bui [Tue, 13 Sep 2022 14:13:16 +0000 (16:13 +0200)] 
analyze: extend the dump command to accept patterns

The new function DumpPatterns() can be used to limit (drastically) the size of
the data returned by PID1. Hence the optimization of serializing data into a
file descriptor should be less relevant than having the possibility to limit
the data when communicating with the service manager remotely.

NB: when passing patterns, the dump command omits the version of the manager as
well as the features and the timestamps.

23 months agoMerge pull request #24625 from yuwata/dissect-image-open-and-lock-decrypted
Yu Watanabe [Wed, 12 Oct 2022 22:47:08 +0000 (07:47 +0900)] 
Merge pull request #24625 from yuwata/dissect-image-open-and-lock-decrypted

dissect-image: open dissected and decrypted partitions

23 months agogpt-auto: allow using without cryptsetup
David Seifert [Wed, 12 Oct 2022 19:47:29 +0000 (21:47 +0200)] 
gpt-auto: allow using without cryptsetup

Fixes #24978

23 months agodissect-image: introduce probe_filesystem_full() which can take file descriptor of... 24625/head
Yu Watanabe [Sat, 1 Oct 2022 02:02:40 +0000 (11:02 +0900)] 
dissect-image: introduce probe_filesystem_full() which can take file descriptor of device node

In dissect_loop_device(), we have opened the device node. Let's reuse
the file descriptor.

23 months agodissect-image: open dissected or decrypted partitions and mount through the file...
Yu Watanabe [Fri, 9 Sep 2022 20:44:27 +0000 (05:44 +0900)] 
dissect-image: open dissected or decrypted partitions and mount through the 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.

23 months agodissect-image: try to open device node before activating
Yu Watanabe [Fri, 16 Sep 2022 20:03:24 +0000 (05:03 +0900)] 
dissect-image: try to open device node before activating

Hopefully decrease the chance that the device is removed soon after
it is detected.

23 months agodissect-image: fix error handling of @cancel_deferred_remove DM command
Yu Watanabe [Sat, 17 Sep 2022 06:27:15 +0000 (15:27 +0900)] 
dissect-image: fix error handling of @cancel_deferred_remove DM command

See target_message() in drivers/md/dm-ioctl.c and
dm_cancel_deferred_remove() in drivers/md/dm.c.

23 months agodissect-image: reduce indentation
Yu Watanabe [Fri, 16 Sep 2022 18:30:13 +0000 (03:30 +0900)] 
dissect-image: reduce indentation

No functional change, just refactoring.

23 months agotest: disable LSan in the ASan env wrapper
Frantisek Sumsal [Wed, 12 Oct 2022 15:28:47 +0000 (17:28 +0200)] 
test: disable LSan in the ASan env wrapper

This wrapper is used in situations where  we don't care about *San reports,
we just want to make things work. However, with enabled LSan we might
trigger some bogus reports we're definitely not interested in, causing
unexpected test fails.

Spotted on C8S in TEST-34-DYNAMICUSERMIGRATE:
```
[10654.804162] testsuite-34.sh[56]: + systemctl start testservice-34-check-writable.service
         Starting testservice-34-check-writable.service...
[10655.055969] bash[546]: + set -o pipefail
[10655.056127] bash[546]: + declare -a writable_dirs
[10655.056234] bash[546]: + readarray -t writable_dirs
[10655.060838] bash[548]: ++ find / '(' -path /var/tmp -o -path /tmp -o -path /proc -o -path /dev/mqueue -o -path /dev/shm -o -path /sys/fs/bpf -o -path /dev/.lxc -o -path /sys/devices/system/cpu ')' -prune -o -type d -writable -print
[10655.061534] bash[549]: ++ sort -u
[10655.688740] bash[547]: =================================================================
[10655.689075] bash[547]: ==547==ERROR: LeakSanitizer: detected memory leaks
[10655.689246] bash[547]: Direct leak of 112 byte(s) in 1 object(s) allocated from:
[10655.743851] bash[547]:     #0 0x7ffff752d364  (/usr/lib64/clang/14.0.0/lib/libclang_rt.asan-powerpc64le.so+0x13d364) (BuildId: 321f4ed1caea6a1a4c37f9272e07275cf16f034d)
[10655.744060] bash[547]:     #1 0x1000b5d20 in xmalloc (/usr/bin/bash+0xb5d20) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.744224] bash[547]:     #2 0x100083338  (/usr/bin/bash+0x83338) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.744393] bash[547]:     #3 0x10008847c  (/usr/bin/bash+0x8847c) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.744552] bash[547]:     #4 0x1000af6ec in redirection_expand (/usr/bin/bash+0xaf6ec) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.744728] bash[547]:     #5 0x1000b005c  (/usr/bin/bash+0xb005c) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.744886] bash[547]:     #6 0x1000b1388 in do_redirections (/usr/bin/bash+0xb1388) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.745051] bash[547]:     #7 0x100050484  (/usr/bin/bash+0x50484) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.745208] bash[547]:     #8 0x100052160 in execute_command_internal (/usr/bin/bash+0x52160) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.745376] bash[547]:     #9 0x100052a10 in execute_command_internal (/usr/bin/bash+0x52a10) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.745536] bash[547]:     #10 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.745711] bash[547]:     #11 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.745870] bash[547]:     #12 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.746038] bash[547]:     #13 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.746198] bash[547]:     #14 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.746367] bash[547]:     #15 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.746548] bash[547]:     #16 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.746741] bash[547]:     #17 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.746897] bash[547]:     #18 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.747067] bash[547]:     #19 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.747227] bash[547]:     #20 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.747414] bash[547]:     #21 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.747573] bash[547]:     #22 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.747741] bash[547]:     #23 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.747896] bash[547]:     #24 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.748064] bash[547]:     #25 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.748225] bash[547]:     #26 0x100053e38 in execute_command (/usr/bin/bash+0x53e38) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.748390] bash[547]:     #27 0x1000529d8 in execute_command_internal (/usr/bin/bash+0x529d8) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.748553] bash[547]:     #28 0x1000bf91c in parse_and_execute (/usr/bin/bash+0xbf91c) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.748717] bash[547]:     #29 0x1000311ec  (/usr/bin/bash+0x311ec) (BuildId: da38eb38f6870bdc2a6ef51c52aa6ce20921fe40)
[10655.748883] bash[547]: Direct leak of 17 byte(s) in 1 object(s) allocated from:
...
```

23 months agoMerge pull request #24883 from bluca/extrel_force
Luca Boccassi [Wed, 12 Oct 2022 18:20:46 +0000 (20:20 +0200)] 
Merge pull request #24883 from bluca/extrel_force

portable: allow caller to override extension-release name check

23 months agoMerge pull request #24974 from yuwata/sd-journal
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 15:47:05 +0000 (17:47 +0200)] 
Merge pull request #24974 from yuwata/sd-journal

sd-journal: several cleanups and follow-ups for compact mode PR

23 months agoMerge pull request #24976 from mbiebl/logind-fix-dbus-on_ac_power
Michael Biebl [Wed, 12 Oct 2022 14:55:21 +0000 (16:55 +0200)] 
Merge pull request #24976 from mbiebl/logind-fix-dbus-on_ac_power

logind: fix getting property OnExternalPower via D-Bus

23 months agoMerge pull request #24934 from keszybz/remove-nss-lookup
Luca Boccassi [Wed, 12 Oct 2022 13:21:40 +0000 (15:21 +0200)] 
Merge pull request #24934 from keszybz/remove-nss-lookup

Remove nss lookups from pid1

23 months agoboot: Always reconnect all drivers
Jan Janssen [Wed, 12 Oct 2022 07:39:59 +0000 (09:39 +0200)] 
boot: Always reconnect all drivers

Fixes: #23442
23 months agoboot: export reconnect()
Gerd Hoffmann [Mon, 19 Sep 2022 08:56:47 +0000 (10:56 +0200)] 
boot: export reconnect()

Also give it a more descriptive name.

23 months agostub: Correctly handle multi node file paths
Jan Janssen [Tue, 11 Oct 2022 09:19:04 +0000 (11:19 +0200)] 
stub: Correctly handle multi node file paths

Fixes: #24955
23 months agoboot: Use device_path_to_str
Jan Janssen [Tue, 11 Oct 2022 07:45:01 +0000 (09:45 +0200)] 
boot: Use device_path_to_str

23 months agoboot: Add device_path_to_str
Jan Janssen [Sun, 5 Jun 2022 13:31:01 +0000 (15:31 +0200)] 
boot: Add device_path_to_str

23 months agoMerge pull request #24973 from keszybz/simplify-variable-declarations
Yu Watanabe [Wed, 12 Oct 2022 10:36:47 +0000 (19:36 +0900)] 
Merge pull request #24973 from keszybz/simplify-variable-declarations

Simplify variable declarations

23 months agosd-journal: add comments that journal_file_move_to() may break previous read data 24974/head
Yu Watanabe [Wed, 12 Oct 2022 07:19:27 +0000 (16:19 +0900)] 
sd-journal: add comments that journal_file_move_to() may break previous read data

We have already made similar mistakes several times, e.g.
b8478c14c7367c3ec5d47d2680a3390b0dedecb1, and
b596d06c385e104fc330288b791a56661f0c2d17. Let's document the function
invalidates previously read objects.

23 months agosd-journal: re-read object on next try
Yu Watanabe [Wed, 12 Oct 2022 07:08:57 +0000 (16:08 +0900)] 
sd-journal: re-read object on next try

Otherwise, the object may be already altered by another cached entry.

23 months agosd-journal: re-read object from cache
Yu Watanabe [Wed, 12 Oct 2022 06:59:43 +0000 (15:59 +0900)] 
sd-journal: re-read object from cache

Fixes a bug introduced by 0e35afff1db475b46281fac75fa3fc2d7f26cae7.

Replaces 3388a4b5820012b945d9925446764717afcdb5b0.

23 months agosd-journal: drop unused argument
Yu Watanabe [Wed, 12 Oct 2022 06:50:53 +0000 (15:50 +0900)] 
sd-journal: drop unused argument

Follow-up for a9089a6604066a8fa8138af2a6388be48f2a80ef.

23 months agosd-journal: several coding style updates
Yu Watanabe [Wed, 12 Oct 2022 06:39:24 +0000 (15:39 +0900)] 
sd-journal: several coding style updates

- rename `ret` -> `ret_object`,
- add missing assertions,
- add FIXME comments,
- wrap function arguments, etc., etc..

23 months agologind: fix getting property OnExternalPower via D-Bus 24976/head
Michael Biebl [Wed, 12 Oct 2022 09:07:57 +0000 (11:07 +0200)] 
logind: fix getting property OnExternalPower via D-Bus

The BUS_DEFINE_PROPERTY_GET_GLOBAL macro requires a value as third
argument, so we need to call manager_is_on_external_power(). Otherwise
the function pointer is interpreted as a boolean and always returns
true:

```
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager OnExternalPower
b true
$ /lib/systemd/systemd-ac-power  --verbose
no
```

Thanks: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021644

23 months agoportable: allow caller to override extension-release name check 24883/head
Luca Boccassi [Tue, 11 Oct 2022 17:58:33 +0000 (18:58 +0100)] 
portable: allow caller to override extension-release name check

When the --force flag is used, do not insist that the extension-release
file has to match the extension image name

23 months agoportable: rename flag PORTABLE_FORCE -> PORTABLE_FORCE_ATTACH
Luca Boccassi [Tue, 11 Oct 2022 17:53:59 +0000 (18:53 +0100)] 
portable: rename flag PORTABLE_FORCE -> PORTABLE_FORCE_ATTACH

The name is used only internally, also it was just added.
Allows adding different types of force flags.

23 months agoos-util: split out extension-release xattr helper
Luca Boccassi [Tue, 11 Oct 2022 17:31:06 +0000 (18:31 +0100)] 
os-util: split out extension-release xattr helper

23 months agomount-util: do not pass 'x-*' options to mount syscall
Luca Boccassi [Tue, 11 Oct 2022 17:28:10 +0000 (18:28 +0100)] 
mount-util: do not pass 'x-*' options to mount syscall

They will not be recognized. libmount filters them manually.

23 months agoNEWS: expand on systemd-measure a bit
Lennart Poettering [Wed, 12 Oct 2022 08:33:47 +0000 (10:33 +0200)] 
NEWS: expand on systemd-measure a bit

23 months agoupdate TODO with discussions from Image-based Linux summit
Lennart Poettering [Wed, 12 Oct 2022 08:03:56 +0000 (10:03 +0200)] 
update TODO with discussions from Image-based Linux summit

23 months agoMerge pull request #24784 from yuwata/core-exec-directory
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 07:37:16 +0000 (09:37 +0200)] 
Merge pull request #24784 from yuwata/core-exec-directory

core: do not create symlink to private directory if parent already exists

23 months agoMerge pull request #24970 from DaanDeMeyer/crypsetup-fix
Lennart Poettering [Wed, 12 Oct 2022 07:32:56 +0000 (09:32 +0200)] 
Merge pull request #24970 from DaanDeMeyer/crypsetup-fix

Cryptsetup compilation fixes

23 months agobasic/user-util: simplify variable declarations in fget{pw,gr}ent_sane() 24973/head
Zbigniew Jędrzejewski-Szmek [Mon, 3 Oct 2022 09:50:16 +0000 (11:50 +0200)] 
basic/user-util: simplify variable declarations in fget{pw,gr}ent_sane()

23 months agolibsystemd-network: trivial simplification
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 07:18:24 +0000 (09:18 +0200)] 
libsystemd-network: trivial simplification

23 months agoMerge pull request #24867 from yuwata/sd-dhcp6-client-large-packet
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 07:18:07 +0000 (09:18 +0200)] 
Merge pull request #24867 from yuwata/sd-dhcp6-client-large-packet

sd-dhcp6-client: allow to build large packet

23 months agosd-journal: rename next_hash_offset() -> get_next_hash_offset()
Yu Watanabe [Wed, 12 Oct 2022 06:37:00 +0000 (15:37 +0900)] 
sd-journal: rename next_hash_offset() -> get_next_hash_offset()

As the function name conflicts with one of its argument.

23 months agoshared/condition: avoid nss lookup in PID1 24934/head
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 15:34:53 +0000 (17:34 +0200)] 
shared/condition: avoid nss lookup in PID1

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.

23 months agobasic/chase-symlinks: add note that CHASE_WARN is not for PID 1
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 05:58:54 +0000 (07:58 +0200)] 
basic/chase-symlinks: add note that CHASE_WARN is not for PID 1

This should be enough to make us remember that constraint. A more heavy-weight
approach like renaming the option to CHASE_WARN_NSS_LOOKUP would be possible,
but it'd make the callers quite verbose and doesn't seem worth it.

23 months agoRevert "test-journal-flush: Don't fail on EADDRNOTAVAIL"
Yu Watanabe [Tue, 11 Oct 2022 17:48:53 +0000 (02:48 +0900)] 
Revert "test-journal-flush: Don't fail on EADDRNOTAVAIL"

This reverts commit 3388a4b5820012b945d9925446764717afcdb5b0.

The error EADDRNOTAVAIL in the test only comes from journal_file_move_to(),
and it does not mean the corrupted journal, but pure programming error.

23 months agoMerge pull request #24957 from yuwata/network-ignore-failure-in-sending-solicitation
Luca Boccassi [Tue, 11 Oct 2022 19:58:26 +0000 (21:58 +0200)] 
Merge pull request #24957 from yuwata/network-ignore-failure-in-sending-solicitation

network: ignore failure in sending solicitation

23 months agoMerge pull request #24933 from keszybz/erradicate-strerror
Luca Boccassi [Tue, 11 Oct 2022 19:47:38 +0000 (21:47 +0200)] 
Merge pull request #24933 from keszybz/erradicate-strerror

Erradicate strerror

23 months agoMerge pull request #24968 from poettering/logs-show-timestamp-fix
Luca Boccassi [Tue, 11 Oct 2022 19:45:46 +0000 (21:45 +0200)] 
Merge pull request #24968 from poettering/logs-show-timestamp-fix

logs-show timestamp fix

23 months agologind: do not emit beep in wall messages
Zbigniew Jędrzejewski-Szmek [Tue, 11 Oct 2022 11:59:45 +0000 (13:59 +0200)] 
logind: do not emit beep in wall messages

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.

23 months agorepart: Always define VerityMode from/to string functions 24970/head
Daan De Meyer [Tue, 11 Oct 2022 18:36:03 +0000 (20:36 +0200)] 
repart: Always define VerityMode from/to string functions

23 months agocryptsetup-util: Always define dlopen_cryptsetup()
Daan De Meyer [Tue, 11 Oct 2022 18:35:34 +0000 (20:35 +0200)] 
cryptsetup-util: Always define dlopen_cryptsetup()

23 months agotree-wide: drop () around the first argument of a ternary op 24933/head
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 12:50:35 +0000 (14:50 +0200)] 
tree-wide: drop () around the first argument of a ternary op

https://github.com/systemd/systemd/pull/24933#discussion_r991242789

23 months agoman: use man7.org for strerror_r
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 09:00:57 +0000 (11:00 +0200)] 
man: use man7.org for strerror_r

23 months agoman: recommend strerror_r() over strerror()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 14:24:01 +0000 (16:24 +0200)] 
man: recommend strerror_r() over strerror()

Let's nudge people towards the use of an anonymous buffer like we
do internally.

"errno" → "errnum", to match the man page for strerror, and also to avoid
confusion with the global variable. In general, I think that errno is a
terrible interface and we shouldn't encourage people to use it. Those functions
use errno-style error numbers, which are a different thing.

23 months agoman: recommend %m over strerror()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 14:19:21 +0000 (16:19 +0200)] 
man: recommend %m over strerror()

The need to set errno is very very ugly, but at least it is thread-safe and
works correctly. Using strerror() is likely to be wrong, so let's not recommend
that. People who do a lot of logging would provide use some wrapper that sets
errno like we do, so nudge people towards %m.

I tested that all the separate .c files compile cleanly.

23 months agoman: use external .c files for three examples
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 07:18:26 +0000 (09:18 +0200)] 
man: use external .c files for three examples

This way it's much easier to test that the code compiles without issues.
It's also easier to edit the code.

Indentation in one of the examples is reduced to two spaces. This is what we
use in man pages to make them fit on screen better.

23 months agoGet rid of strerror_safe()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:59:34 +0000 (15:59 +0200)] 
Get rid of strerror_safe()

23 months agosd-bus: make bus_error_message() a thread-safe macro
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:56:25 +0000 (15:56 +0200)] 
sd-bus: make bus_error_message() a thread-safe macro

strerror_r() is used instead of strerror(). The usual trick is employed: we
allocate a buffer that lives until the end of the surrounding block to provide
the scratch space. This change is particularly important forn sd-bus and the
pam modules, which may be called from threaded code.

I checked the codebase, and we only use bus_error_message() in log statements,
so the returned pointer is not used beyond its valid lifetime.

23 months agocore: adjust log message
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:53:10 +0000 (15:53 +0200)] 
core: adjust log message

"umount startup job" is rather confusing. Let's say "unmount job", which should
be more meaningful for a user.

23 months agoanalyze: add forgotten return statement
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:52:33 +0000 (15:52 +0200)] 
analyze: add forgotten return statement

We would fail with an assert in sd_bus_message_enter_container() afterwards.

23 months agotree-wide: get rid of lgtm annotations
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 07:31:58 +0000 (09:31 +0200)] 
tree-wide: get rid of lgtm annotations

We now use CodeQL, and LGTM itself is gone. Those old annotations are not
useful for anythign now.

23 months agotree-wide: define and use STRERROR_OR_EOF()
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 19:19:43 +0000 (21:19 +0200)] 
tree-wide: define and use STRERROR_OR_EOF()

23 months agologs-show: be more careful when initializing get_dual_timestamp() return parameters 24968/head
Lennart Poettering [Tue, 11 Oct 2022 14:39:51 +0000 (16:39 +0200)] 
logs-show: be more careful when initializing get_dual_timestamp() return 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

23 months agotree-wide: use STRERROR()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:28:05 +0000 (15:28 +0200)] 
tree-wide: use STRERROR()

23 months agosd-journal: exit loop once we got all fields we are interested in
Lennart Poettering [Tue, 11 Oct 2022 14:39:06 +0000 (16:39 +0200)] 
sd-journal: exit loop once we got all fields we are interested in

23 months agobasic: add STRERROR() wrapper for strerror_r()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 10:28:31 +0000 (12:28 +0200)] 
basic: add STRERROR() wrapper for strerror_r()

23 months agoshared/journal-importer: use %m instead of strerror()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 07:18:26 +0000 (09:18 +0200)] 
shared/journal-importer: use %m instead of strerror()

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().

23 months agocore,logind,systemctl,journald: replace calls to strerror() with setting errno + %m
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 07:15:44 +0000 (09:15 +0200)] 
core,logind,systemctl,journald: replace calls to strerror() with setting errno + %m

strerror() is not thread safe and calling it just isn't worth the effort
required to justify why it would be safe in those cases. It's easier to just
use %m which is thread-safe out of the box. I don't think that any of the
changes in the patch cause any functional difference. This is just about
getting rid of calls to strerror() in general.

When we print an error message and fail to format the string, using something
like "(null)" is good enough. This is very very unlikely to happen anyway.

23 months agobasic/stdio-util: allow xsprintf() to be used without any arguments
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:26:36 +0000 (15:26 +0200)] 
basic/stdio-util: allow xsprintf() to be used without any arguments

xsprintf(buf, "…: %m") would fail, now it works.

23 months agoanalyze: use the same error variable name as everywhere else
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 14:37:57 +0000 (16:37 +0200)] 
analyze: use the same error variable name as everywhere else

23 months agopam_systemd: use pam_syslog_pam_error()
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 12:59:50 +0000 (14:59 +0200)] 
pam_systemd: use pam_syslog_pam_error()

Error handling in acquire_user_record() was checking the wrong
condition (PAM errors are always >= 0, so r < 0 cannot match).

Apart from the fix for error handling, no change in behaviour is intended.
I did some minor adjustements to formatting and added _cleanup_ in one more
place.

23 months agopam_systemd_home: use pam_syslog_pam_error()
Zbigniew Jędrzejewski-Szmek [Tue, 11 Oct 2022 12:51:47 +0000 (14:51 +0200)] 
pam_systemd_home: use pam_syslog_pam_error()

The message in acquire_home() was looking at the wrong variable
('r' instead of 'acquired_fd').

Apart from that, no change in behaviour is intended.

23 months agoshared/pam-util: add pam_syslog_pam_error() wrapper
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 13:47:12 +0000 (15:47 +0200)] 
shared/pam-util: add pam_syslog_pam_error() wrapper

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.

23 months agopam_systemd: use pam_syslog_errno()
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 12:29:53 +0000 (14:29 +0200)] 
pam_systemd: use pam_syslog_errno()

The debug message for "nice" is tweaked to show the level that was set.

Like in the two previous commits, the return code on error might be changed.

23 months agopam_systemd_home: use pam_syslog_errno()
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 12:25:02 +0000 (14:25 +0200)] 
pam_systemd_home: use pam_syslog_errno()

Like in the previous commit, the return code on error might be changed.

23 months agotest-journal-flush: Don't fail on EADDRNOTAVAIL
Daan De Meyer [Tue, 11 Oct 2022 12:01:04 +0000 (14:01 +0200)] 
test-journal-flush: Don't fail on EADDRNOTAVAIL

File corruption can cause EADDRNOTAVAIL errors. Let's not make these
fatal for the flush test.

23 months agomeson: Fix pcrphase unit conditions
Daan De Meyer [Mon, 10 Oct 2022 14:17:22 +0000 (16:17 +0200)] 
meson: Fix pcrphase unit conditions

23 months agologs-show: Always retrieve the boot ID from the entry
Daan De Meyer [Tue, 11 Oct 2022 11:26:41 +0000 (13:26 +0200)] 
logs-show: Always retrieve the boot ID from the entry

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.

23 months agoupdate TODO
Lennart Poettering [Tue, 11 Oct 2022 13:06:16 +0000 (15:06 +0200)] 
update TODO

23 months agoMerge pull request #24629 from DaanDeMeyer/mkosi-kernel
Daan De Meyer [Tue, 11 Oct 2022 12:37:19 +0000 (14:37 +0200)] 
Merge pull request #24629 from DaanDeMeyer/mkosi-kernel

mkosi: Optionally build a kernel image from mkosi.kernel/

23 months agotest: add coverage for the nvme-subsystem
Frantisek Sumsal [Tue, 11 Oct 2022 07:54:35 +0000 (09:54 +0200)] 
test: add coverage for the nvme-subsystem

Specifically for:
  - https://github.com/systemd/systemd/pull/24748
  - https://github.com/systemd/systemd/pull/24766
  - https://github.com/systemd/systemd/pull/24946

23 months agosd-radv: mention that failures in sending RA are ignored 24957/head
Yu Watanabe [Tue, 11 Oct 2022 07:22:35 +0000 (16:22 +0900)] 
sd-radv: mention that failures in sending RA are ignored

23 months agosd-ndisc: ignore failure in sending solicitation
Yu Watanabe [Tue, 11 Oct 2022 07:19:12 +0000 (16:19 +0900)] 
sd-ndisc: ignore failure in sending solicitation

Even if a bonding master interface has carrier, the underlying slave
interfaces may not. In such a case, sending solicitation fails with
-ENOBUS. Here, let's unconditionally ignore errors, as anyway we will
send a solicitation later.

Fixes #24717.

23 months agoudev: add one more assertion
Yu Watanabe [Mon, 10 Oct 2022 15:42:44 +0000 (00:42 +0900)] 
udev: add one more assertion

Follow-up for 6209bbbd4b1c9ed2886028ab2ee3df0a7d0e2494.

23 months agocoredumpctl: Add support for the --root option (after merge fixes)
Richard Phibel [Mon, 10 Oct 2022 13:40:02 +0000 (15:40 +0200)] 
coredumpctl: Add support for the --root option (after merge fixes)