]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agorandom-seed: make one more use of random_write_entropy()
Franck Bui [Wed, 19 Oct 2022 13:28:27 +0000 (15:28 +0200)] 
random-seed: make one more use of random_write_entropy()

No functional change.

3 years agorandom-seed: shorten a bit may_credit()
Franck Bui [Wed, 19 Oct 2022 13:27:04 +0000 (15:27 +0200)] 
random-seed: shorten a bit may_credit()

No functional change.

3 years agoMerge pull request #24777 from medhefgo/stub
Zbigniew Jędrzejewski-Szmek [Tue, 18 Oct 2022 05:36:20 +0000 (07:36 +0200)] 
Merge pull request #24777 from medhefgo/stub

stub: Use LoadImage/StartImage

3 years agoMerge pull request #25035 from keszybz/manager-method-names
Luca Boccassi [Mon, 17 Oct 2022 21:11:13 +0000 (23:11 +0200)] 
Merge pull request #25035 from keszybz/manager-method-names

Manager method names

3 years agotest: call sync() before checking the test logs
Frantisek Sumsal [Mon, 17 Oct 2022 16:11:21 +0000 (18:11 +0200)] 
test: call sync() before checking the test logs

Otherwise we might hit a race where we read the test log just before
it's fully written to the disk:

```
======================================================================
FAIL: test_interleaved (__main__.ExecutionResumeTest.test_interleaved)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/systemd/test/test-exec-deserialization.py", line 170, in test_interleaved
    self.check_output(expected_output)
  File "/root/systemd/test/test-exec-deserialization.py", line 111, in check_output
    self.assertEqual(output, expected_output)
AssertionError: 'foo\n' != 'foo\nbar\n'
  foo
+ bar
```

With some debug:
```
test_interleaved (__main__.ExecutionResumeTest.test_interleaved) ...
Assertion failed; file contents just after the assertion:
b'foo\n'

File contents 5 seconds later:
b'foo\nbar\n'
FAIL
```

Seen quite often in CentOS CI on the fast baremetal machines.

3 years agoMerge pull request #25039 from mrc0mmand/test-tewaks
Luca Boccassi [Mon, 17 Oct 2022 19:52:00 +0000 (21:52 +0200)] 
Merge pull request #25039 from mrc0mmand/test-tewaks

A couple of minor tweaks for recent CI fails

3 years agoMerge pull request #24992 from yuwata/sd-device-monitor-receive-buffer
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2022 18:49:18 +0000 (20:49 +0200)] 
Merge pull request #24992 from yuwata/sd-device-monitor-receive-buffer

sd-device-monitor: dynamically allocate receive buffer

3 years agoman: add missing reference to systemd-pcrphase-sysinit.service
Lennart Poettering [Mon, 17 Oct 2022 13:21:49 +0000 (15:21 +0200)] 
man: add missing reference to systemd-pcrphase-sysinit.service

3 years agoMerge pull request #25036 from keszybz/plurals
Luca Boccassi [Mon, 17 Oct 2022 15:12:16 +0000 (17:12 +0200)] 
Merge pull request #25036 from keszybz/plurals

Remove usage of "noun(s)" in messages and docs

3 years agoxdg-autostart-service: Add comments to tilde expansion, use path_join()
David Edmundson [Tue, 11 Oct 2022 10:18:13 +0000 (11:18 +0100)] 
xdg-autostart-service: Add comments to tilde expansion, use path_join()

Follow-ups for https://github.com/systemd/systemd/pull/24658

3 years agoUpdate TODO
Daan De Meyer [Mon, 17 Oct 2022 14:06:39 +0000 (16:06 +0200)] 
Update TODO

3 years agomkosi: Switch to Fedora 37
Daan De Meyer [Mon, 17 Oct 2022 12:53:16 +0000 (14:53 +0200)] 
mkosi: Switch to Fedora 37

Official release date is close so let's switch mkosi CI to it already.

3 years agomeson: drop repeated output in error message 25036/head
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2022 12:01:16 +0000 (14:01 +0200)] 
meson: drop repeated output in error message

3 years agotree-wide: replace "plural(s)" by "plurals"
Zbigniew Jędrzejewski-Szmek [Sat, 15 Oct 2022 14:06:20 +0000 (16:06 +0200)] 
tree-wide: replace "plural(s)" by "plurals"

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

3 years agotest: use SIGKILL to kill the container if necessary 25039/head
Frantisek Sumsal [Mon, 17 Oct 2022 13:00:12 +0000 (15:00 +0200)] 
test: use SIGKILL to kill the container if necessary

TEST-69 uses a Python wrapper around the systemd-nspawn call, which on
error calls the `spawn.terminate()` method. However, with no arguments
it will only use SIGHUP and SIGINT signals - this might leave a stuck
container around, causing fails if the test is run again. With `force=True`
SIGKILL is used as well (if necessary).

3 years agotest: add test for large uevent message 24992/head
Yu Watanabe [Mon, 17 Oct 2022 12:48:27 +0000 (21:48 +0900)] 
test: add test for large uevent message

3 years agoboot: Rework shim image verification 24777/head
Jan Janssen [Fri, 14 Oct 2022 09:09:12 +0000 (11:09 +0200)] 
boot: Rework shim image verification

This moves the shim security arch override to the new
ReinstallProtocolInterface based interface. This also has the benefit to
reduce the time window in which we have this override active and also
actually removes it, which was not previously done.

The shim hooks themselves are also modernized too. The upcalls should
really not be neccessary if shim is happy with the provided binary.

3 years agosd-device-monitor: dynamically allocate receive buffer
Yu Watanabe [Thu, 13 Oct 2022 16:18:47 +0000 (01:18 +0900)] 
sd-device-monitor: dynamically allocate receive buffer

If udevd broadcasts a processed device with huge amount of properties,
then clients cannot receive the device.

Fixes #24987.

3 years agostub: Allow loading unsigned kernel images
Jan Janssen [Wed, 21 Sep 2022 10:56:20 +0000 (12:56 +0200)] 
stub: Allow loading unsigned kernel images

3 years agoboot: Use proper security arch protocol names
Jan Janssen [Wed, 21 Sep 2022 10:39:46 +0000 (12:39 +0200)] 
boot: Use proper security arch protocol names

This is how the Platform Intregration Specification defines these.

3 years agoboot: Remove unused parameters from pe_kernel_info
Jan Janssen [Wed, 21 Sep 2022 10:23:36 +0000 (12:23 +0200)] 
boot: Remove unused parameters from pe_kernel_info

Only the compat entry address is used now. This also now only returns
the compat entry address. If the image is native we do not need to try
calling into the entry address again as we would already have done so
from StartImage (and failed).

3 years agostub: Use LoadImage/StartImage to start the kernel
Jan Janssen [Wed, 21 Sep 2022 09:07:53 +0000 (11:07 +0200)] 
stub: Use LoadImage/StartImage to start the kernel

This is the proper way to start any EFI binary. The fact this even ever
worked was because the kernel does not have any PE relocations.

The only downside is that the embedded kernel image has to be signed and
trusted by the firmware under secure boot. A future commit will try to
deal with that.

3 years agostub: Rename image parameter
Jan Janssen [Wed, 21 Sep 2022 08:42:40 +0000 (10:42 +0200)] 
stub: Rename image parameter

This is really the parent image for the kernel that is to be run.
Renaming it as such prevents confusion with any image handles that are
about to be created.

3 years agotest: drop one layer of escaping
Frantisek Sumsal [Mon, 17 Oct 2022 12:38:00 +0000 (14:38 +0200)] 
test: drop one layer of escaping

3 years agotest: ignore gcov errors in TEST-34
Frantisek Sumsal [Mon, 17 Oct 2022 12:31:25 +0000 (14:31 +0200)] 
test: ignore gcov errors in TEST-34

TEST-34 complains in `test_check_writable` when running with gcov, as
the build directory tree is not writable with DynamicUser=true. As I had
no luck with $GCOV_PREFIX and other runtime gcov configuration, let's
just ignore the gcov errors for this test.

3 years agocryptsetup: drop redundant parens/drop ternary op
Lennart Poettering [Sun, 16 Oct 2022 22:14:21 +0000 (00:14 +0200)] 
cryptsetup: drop redundant parens/drop ternary op

A ternary op is a bit weird to use if we end up assigning a variable to
itself in one of the branches. Hence use a plain if check.

3 years agoman: fix method name 25035/head
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2022 09:31:52 +0000 (11:31 +0200)] 
man: fix method name

3 years agocore: simplify the return convention in manager_load_unit()
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2022 08:48:52 +0000 (10:48 +0200)] 
core: simplify the return convention in manager_load_unit()

This function was returning 0 or 1 on success. It has many callers, and it
wasn't clear if any of them care about the distinction. It turns out they don't
and the return values were done for convenience because manager_load_unit_prepare()
returns 0 or 1. Let's invert the code in the static function to follow the usual
pattern where 0 means "no work was done" and 1 means "work was done", and make
the non-static function always return 0 to make the code easier to read, and
also add comments that explain what is happening.

No functional change.

3 years agocore: modernize style of return param naming
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2022 07:01:12 +0000 (09:01 +0200)] 
core: modernize style of return param naming

3 years agoMerge pull request #24919 from anitazha/varlinkserialize
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2022 11:44:28 +0000 (13:44 +0200)] 
Merge pull request #24919 from anitazha/varlinkserialize

varlink/pid1 fixes for systemd-oomd (addresses #20330)

3 years agoMerge pull request #24986 from keszybz/news-systemd-measure
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2022 11:24:07 +0000 (13:24 +0200)] 
Merge pull request #24986 from keszybz/news-systemd-measure

NEWS: rework the description of systemd-measure a bit again

3 years agopcrphase: fix --help text
Lennart Poettering [Mon, 17 Oct 2022 10:27:41 +0000 (12:27 +0200)] 
pcrphase: fix --help text

We don't take a command, we just take a "word" which we'll extend into
PCR 11.

3 years agopcrphase: add two additional phases
Lennart Poettering [Fri, 14 Oct 2022 18:53:42 +0000 (20:53 +0200)] 
pcrphase: add two additional phases

This adds two more phases to the PCR boot phase logic: "sysinit" +
"final".

The "sysinit" one is placed between sysinit.target and basic.target.
It's good to have a milestone in this place, since this is after all
file systems/LUKS volumes are in place (which sooner or later should
result in measurements of their own) and before services are started
(where we should be able to rely on them to be complete).

This is particularly useful to make certain secrets available for
mounting secondary file systems, but making them unavailable later.

This breaks API in a way (as measurements during runtime will change),
but given that the pcrphase stuff wasn't realeased yet should be OK.

3 years agotests: add nspawn's rootidmap integration test
Quentin Deslandes [Tue, 6 Sep 2022 13:42:43 +0000 (14:42 +0100)] 
tests: add nspawn's rootidmap integration test

Add integration test to testsuite-13.sh to ensure rootidmap option map
user IDs as expected.

3 years agoMerge pull request #24938 from msizanoen1/journald-harden-clock-jump
Luca Boccassi [Mon, 17 Oct 2022 10:00:02 +0000 (12:00 +0200)] 
Merge pull request #24938 from msizanoen1/journald-harden-clock-jump

journald: harden against forward clock jumps before unclean shutdown

3 years agoMerge pull request #25003 from DaanDeMeyer/mkosi-fixes
Luca Boccassi [Mon, 17 Oct 2022 09:36:55 +0000 (11:36 +0200)] 
Merge pull request #25003 from DaanDeMeyer/mkosi-fixes

mkosi: Add Centos Stream 8 back to CI

3 years agoupdate TODO
Lennart Poettering [Sun, 16 Oct 2022 16:16:53 +0000 (18:16 +0200)] 
update TODO

3 years agomkosi: Add Centos Stream 8 back to CI 25003/head
Daan De Meyer [Fri, 14 Oct 2022 12:30:12 +0000 (14:30 +0200)] 
mkosi: Add Centos Stream 8 back to CI

We can build all of systemd's features again on CentOS Stream 8, so
let's add it back to CI.

3 years agomkosi: Make sure bpf-framework works on CentOS Stream 8 as well
Daan De Meyer [Fri, 14 Oct 2022 12:53:41 +0000 (14:53 +0200)] 
mkosi: Make sure bpf-framework works on CentOS Stream 8 as well

3 years agoREADME: Fix libbpf minimum version
Daan De Meyer [Fri, 14 Oct 2022 12:27:48 +0000 (14:27 +0200)] 
README: Fix libbpf minimum version

This didn't get properly updated as part of #24511

3 years agomkosi: Reenable bpf-framework
Daan De Meyer [Fri, 14 Oct 2022 12:26:50 +0000 (14:26 +0200)] 
mkosi: Reenable bpf-framework

This got changed by mistake by #24511. Since we still support the
same libbpf version, we can keep this enabled everywhere.

3 years agoqrcode-util: Add support for libqrencode 3.0
Daan De Meyer [Fri, 14 Oct 2022 12:21:43 +0000 (14:21 +0200)] 
qrcode-util: Add support for libqrencode 3.0

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.

3 years agostub: Fix booting with old kernels
Jan Janssen [Sun, 16 Oct 2022 07:36:21 +0000 (09:36 +0200)] 
stub: Fix booting with old kernels

This fixes a regression introduced in e1636807 that removed setting this
value as it seemingly was not used by the kernel and would actively
break above 4G boots. But old kernels (4.18 in particular) will not boot
properly if it is not filled out by us.
The original issue was using the truncated value to then jump into the
kernel entry point, which we do not do anymore. So setting this value
again on newer kernels is fine.

3 years agogpt-auto: rename all functions that operate on a DissectedPartition object add_partit...
Lennart Poettering [Fri, 14 Oct 2022 13:46:04 +0000 (15:46 +0200)] 
gpt-auto: rename all functions that operate on a DissectedPartition object add_partition_xyz()

The function for handling regular mounts based on DissectedPartition
objects is called add_partition_mount(), so let's follow this scheme for
all other functions that handle them, too. This nicely separates out the
low-level functions (which get split up args) from the high-level
functions (which get a DissectedPartition object): the latter are called
add_partition_xyz() the former just add_xyz().

This makes naming a bit more systematic. No change in behaviour.

3 years agogenerator: modernize generator_open_unit_file()
Lennart Poettering [Sun, 16 Oct 2022 20:37:26 +0000 (22:37 +0200)] 
generator: modernize generator_open_unit_file()

3 years agogpt-auto-generator: use our usual ret_xyz parameter naming
Lennart Poettering [Fri, 14 Oct 2022 13:30:06 +0000 (15:30 +0200)] 
gpt-auto-generator: use our usual ret_xyz parameter naming

3 years agoman: mention that pcrphase also measures into PCR 11
Lennart Poettering [Fri, 14 Oct 2022 13:27:53 +0000 (15:27 +0200)] 
man: mention that pcrphase also measures into PCR 11

3 years agocryptsetup: use errno-flavoured logging where we have an errno
Lennart Poettering [Fri, 14 Oct 2022 12:42:37 +0000 (14:42 +0200)] 
cryptsetup: use errno-flavoured logging where we have an errno

3 years agotpm2-util: fix parameter name
Lennart Poettering [Tue, 11 Oct 2022 16:22:21 +0000 (18:22 +0200)] 
tpm2-util: fix parameter name

3 years agojournal: fix indentation in managed_journal_file_open_reliably 24938/head
msizanoen1 [Tue, 11 Oct 2022 11:16:41 +0000 (18:16 +0700)] 
journal: fix indentation in managed_journal_file_open_reliably

3 years agojournald: harden against forward clock jumps before unclean shutdown
msizanoen1 [Sat, 8 Oct 2022 12:41:18 +0000 (19:41 +0700)] 
journald: harden against forward clock jumps before unclean shutdown

Try harder to inherit the sequence number and ID from the old journal
file before rotating it away.

This helps the libsystemd journal file selection code make better decisions
even in the face of massive incorrect forward clock jumps prior to an
unclean shutdown.

3 years agoseccomp: add riscv_flush_icache to allow list
Celeste Liu [Sun, 16 Oct 2022 02:47:17 +0000 (10:47 +0800)] 
seccomp: add riscv_flush_icache to allow list

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>
3 years agoudev: drop unused source file
Yu Watanabe [Sat, 15 Oct 2022 00:30:22 +0000 (09:30 +0900)] 
udev: drop unused source file

Follow-up for 5bbcfbaa11a92732f9bbc8d5f77e9311e6ac3d56.

3 years agoseccomp: drop per arch conditionalization in filter groups
Lennart Poettering [Fri, 14 Oct 2022 16:02:31 +0000 (18:02 +0200)] 
seccomp: drop per arch conditionalization in filter groups

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.

3 years agoUpdate list of partition type identifiers
Pyfisch [Fri, 14 Oct 2022 19:32:47 +0000 (21:32 +0200)] 
Update list of partition type identifiers

Include verity sig partition identifiers.
List all supported CPU architectures.

3 years agoDocument two systemd-repart options in man page
Pyfisch [Fri, 14 Oct 2022 18:43:16 +0000 (20:43 +0200)] 
Document two systemd-repart options in man page

Note --private-key and --certificate options for configuring
verity signature partitions in the listing of options.

Adjust one error message referring to the --certificate option.

3 years agoupdate TODO
Lennart Poettering [Fri, 14 Oct 2022 11:05:37 +0000 (13:05 +0200)] 
update TODO

3 years agobasic/mountpoint-util: skip dependency on quota services for some filesystems
Thomas Blume [Thu, 29 Sep 2022 12:50:48 +0000 (14:50 +0200)] 
basic/mountpoint-util:  skip dependency on quota services for some filesystems

3 years agoMerge pull request #25002 from poettering/install-type-fix
Luca Boccassi [Fri, 14 Oct 2022 18:56:44 +0000 (20:56 +0200)] 
Merge pull request #25002 from poettering/install-type-fix

install: make InstallChangeType enum a proper enum

3 years agocore: only allow systemd-oomd to use SubscribeManagedOOMCGroups 24919/head
Anita Zhang [Wed, 5 Oct 2022 08:40:40 +0000 (01:40 -0700)] 
core: only allow systemd-oomd to use SubscribeManagedOOMCGroups

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.

3 years agocore: serialize/deserialize varlink sockets for pid1
Anita Zhang [Wed, 5 Oct 2022 07:13:32 +0000 (00:13 -0700)] 
core: serialize/deserialize varlink sockets for pid1

Fixes #20330

3 years agoelf-util: drop assertion for metadata in report_module_metadata()
Yu Watanabe [Fri, 14 Oct 2022 08:18:41 +0000 (17:18 +0900)] 
elf-util: drop assertion for metadata in report_module_metadata()

Fixes a bug introduced by 1a0281a3ebf4f8c16d40aa9e63103f16cd23bb2a.

Fixes RHBZ#2134741 (https://bugzilla.redhat.com/show_bug.cgi?id=2134741).

3 years agoshared/logs-show: do not overwrite journal time in export format with source timestamps
msizanoen1 [Wed, 12 Oct 2022 06:40:05 +0000 (13:40 +0700)] 
shared/logs-show: do not overwrite journal time in export format with source 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.

3 years agoman: reword some awkward sentences 24986/head
Zbigniew Jędrzejewski-Szmek [Thu, 13 Oct 2022 20:30:48 +0000 (22:30 +0200)] 
man: reword some awkward sentences

3 years agoNEWS: rework the description of systemd-measure a bit again
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 15:05:27 +0000 (17:05 +0200)] 
NEWS: rework the description of systemd-measure a bit again

Try to separate the description so that changes are described first, and the
discussion follows separately. Remove some repeated verbose descriptions of the
subject: if one sentence describes that UKI contains an signature and describes
it in detail, the next sentence can just say "the signature" without
elaborating. Also, we don't do version-keying yet, so don't say "future"
kernels — older kernels will work too.

3 years agoudev-builtin-kmod: support to run without arguments
Yu Watanabe [Fri, 14 Oct 2022 07:18:35 +0000 (16:18 +0900)] 
udev-builtin-kmod: support to run without arguments

If no module name is provided, then try to load modules based on the
device modealias.

Previously, MODALIAS property is passed as an argument, but it may
contain quotation. Hence, unfortunately the modalias may be modified
and cannot load expected modules.

Fixes #24715.

3 years agoinstall: include full type name in special UnitFilePresetMode values 25002/head
Lennart Poettering [Fri, 14 Oct 2022 09:12:19 +0000 (11:12 +0200)] 
install: include full type name in special UnitFilePresetMode values

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.

3 years 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.

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

3 years agocore: refactor manager varlink init
Anita Zhang [Wed, 5 Oct 2022 07:12:53 +0000 (00:12 -0700)] 
core: refactor manager varlink init

Split out per-socket code into a separate function to use as part of
serialize/deserialize in the next commit.

3 years agovarlink: refactor adding socket event source to the event loop
Anita Zhang [Tue, 11 Oct 2022 09:36:32 +0000 (02:36 -0700)] 
varlink: refactor adding socket event source to the event loop

3 years 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.

3 years 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

3 years 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.

3 years 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.

3 years 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.

3 years 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.

3 years 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

3 years 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'

3 years 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.

3 years 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.

3 years 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.

3 years 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

3 years 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).

3 years 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).

3 years 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).

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

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

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

3 years 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.

3 years 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

3 years 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

3 years 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.

3 years 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.

3 years 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.

3 years 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.

3 years 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.

3 years 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:
...
```

3 years 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

3 years 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