1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-22 22:03:43 +03:00

55774 Commits

Author SHA1 Message Date
Michael Biebl
885e4e531b Do not fail EFI build with newer binutils
Newer binutils versions currently trigger the following warnings due to
a bug in gnu-efi

on arm64:
/usr/bin/ld.bfd: warning: src/boot/efi/systemd-bootaa64.elf has a LOAD segment with RWX permissions

on amd64:
/usr/bin/ld.bfd: warning: /usr/lib/crt0-efi-x86_64.o: missing .note.GNU-stack section implies executable stack

This results in a build failure due to --fatal-warnings.
Work around this issue by suppressing those warnings until gnu-efi has
been fixed.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1013341

(cherry picked from commit b0e5bf0451a6bc94e6e7b2a1de668b75c63f38c8)
(cherry picked from commit 8a6f966be404897b5333c218701965ac3b5a0806)
2022-11-04 13:02:18 +01:00
Martin Wilck
a96ef943b4 core/device: device_coldplug(): don't set DEVICE_DEAD
dm-crypt device units generated by systemd-cryptsetup-generator
habe BindsTo= dependencies on their backend devices. The dm-crypt
devices have the db_persist flag set, and thus survive the udev db
cleanup while switching root. But backend devices usually don't survive.
These devices are neither mounted nor used for swap, thus they will
seen as DEVICE_NOT_FOUND after switching root.

The BindsTo dependency will cause systemd to schedule a stop
job for the dm-crypt device, breaking boot:

[   68.929457] krypton systemd[1]: systemd-cryptsetup@cr_root.service: Unit is stopped because bound to inactive unit dev-disk-by\x2duuid-3bf91f73\x2d1ee8\x2d4cfc\x2d9048\x2d93ba349b786d.device.
[   68.945660] krypton systemd[1]: systemd-cryptsetup@cr_root.service: Trying to enqueue job systemd-cryptsetup@cr_root.service/stop/replace
[   69.473459] krypton systemd[1]: systemd-cryptsetup@cr_root.service: Installed new job systemd-cryptsetup@cr_root.service/stop as 343

Avoid this by not setting the state of the backend devices to
DEVICE_DEAD.

Fixes the LUKS setup issue reported in #23429.

(cherry picked from commit cf1ac0cfe44997747b0f857a1d0b67cea1298272)
(cherry picked from commit 4f86dd28499cf3f7338dc3368d18eccbb126b4a9)
2022-11-04 13:02:18 +01:00
Nick Rosbrook
608264bb63 pstore: do not try to load all known pstore modules
Commit 70e74a5997 ("pstore: Run after modules are loaded") added After=
and Wants= entries for all known kernel modules providing a pstore.

While adding these dependencies on systems where one of the modules is
not present, or not configured, should not have a real affect on the
system, it can produce annoying error messages in the kernel log. E.g.
"mtd device must be supplied (device name is empty)" when the mtdpstore
module is not configured correctly.

Since dependencies cannot be removed with drop-ins, if a distro wants to
remove some of these modules from systemd-pstore.service, they need to
patch units/systemd-pstore.service.in. On the other hand, if they want
to append to the dependencies this can be done by shipping a drop-in.

Since the original intent of the previous commit was to fix [1], which
only requires the efi_pstore module, remove all other kernel module
dependencies from systemd-pstore.service, and let distros ship drop-ins
to add dependencies if needed.

[1] https://github.com/systemd/systemd/issues/18540

(cherry picked from commit 8b8bd621e1d16808678fc3afed257df1fa03a281)
2022-11-03 16:38:28 +01:00
Alexander Graf
60a239c54e pstore: Run after modules are loaded
The systemd-pstore service takes pstore files on boot and transfers them
to disk. It only does it once on boot and only if it finds any. The typical
location of the pstore on modern systems is the UEFI variable store.

Most distributions ship with CONFIG_EFI_VARS_PSTORE=m. That means, the
UEFI variable store is only available on boot after the respective module
is loaded.

In most situations, the pstore service gets loaded before the UEFI pstore,
so we don't get to transfer logs. Instead, they accumulate, filling up the
pstore over time, potentially breaking the UEFI variable store.

Let's add a service dependency on any kernel module that can provide a
pstore to ensure we only scan for pstate after we can actually see pstate.

I have seen live occurences of systems breaking because we did not erase
the pstates and ran out of UEFI nvram space.

Fixes https://github.com/systemd/systemd/issues/18540

(cherry picked from commit 70e74a5997ae2ce7ba72a74ac949c3b2dad1a1d6)
2022-11-03 16:38:28 +01:00
Yu Watanabe
b927b303c1 core/device: do not downgrade device state if it is already enumerated
On switching root, a device may have a persistent databse. In that case,
Device.enumerated_found may have DEVICE_FOUND_UDEV flag, and it is not
necessary to downgrade the Device.deserialized_found and
Device.deserialized_state. Otherwise, the state of the device unit may
be changed plugged -> dead -> plugged, if the device has not been mounted.

Fixes #23429.

[mwilck: cherry-picked from #23437]

(cherry picked from commit 4fc69e8a0949c2537019466f839d9b7aee5628c9)
(cherry picked from commit 131206de786cd5c4d82d7a49ec1f6e562775022d)
2022-09-30 16:56:18 +02:00
Yu Watanabe
c2939963fe core/device: ignore DEVICE_FOUND_UDEV bit on switching root
The issue #12953 is caused by the following:
On switching root,
- deserialized_found == DEVICE_FOUND_UDEV | DEVICE_FOUND_MOUNT,
- deserialized_state == DEVICE_PLUGGED,
- enumerated_found == DEVICE_FOUND_MOUNT,
On switching root, most devices are not found by the enumeration process.
Hence, the device state is set to plugged by device_coldplug(), and then
changed to the dead state in device_catchup(). So the corresponding
mount point is unmounted. Later when the device is processed by udevd, it
will be changed to plugged state again.

The issue #23208 is caused by the fact that generated udev database in
initramfs and the main system are often different.

So, the two issues have the same root; we should not honor
DEVICE_FOUND_UDEV bit in the deserialized_found on switching root.

This partially reverts c6e892bc0eebe1d42c282bd2d8bae149fbeba85f.

Fixes #12953 and #23208.
Replaces #23215.

Co-authored-by: Martin Wilck <mwilck@suse.com>
(cherry picked from commit 75d7b5989f99125e52d5c0e5656fa1cd0fae2405)
2022-09-30 16:56:18 +02:00
Yu Watanabe
b16a4d45eb sd-device: make sd_device_get_is_initialized() not return -ENOENT
(cherry picked from commit 591c186f2fc11523e098fbb09b3c1f0a07d49ca4)
(cherry picked from commit d36b2af98783cafb2789473c2ea2cce3ce055ebc)
v250.8
2022-07-13 13:30:45 +02:00
Yu Watanabe
b791f05992 resolve: introduce FORMAT_DNS_RCODE() macro
Fixes #23958.

(cherry picked from commit 0d609349ba7e4df07c548c1cfe5127b431de7554)
(cherry picked from commit a03ea9798afa4f2c757c2a2556f735b6aa600c99)
2022-07-13 13:30:45 +02:00
Yu Watanabe
3f909ca95a sd-dhcp-client: fix log message
(cherry picked from commit 3857d367f0028dd5480498ba5d3507866c7f294e)
(cherry picked from commit d56649142b01652976b6ee647f51fa25f4227542)
2022-07-13 13:30:45 +02:00
Yu Watanabe
45944e44a7 network: drop redundant warning
If file is world readable, then `read_full_file_full()` will warn
about that.

(cherry picked from commit d5ad2ec1d409e983cc8727f343137bfb8615a57d)
(cherry picked from commit c87c7e723193d6a19f0d8c195296b6f00eeb3b55)
2022-07-13 13:30:45 +02:00
Yu Watanabe
e2335238d9 core/load-fragment: fix error value in log_syntax()
`extract_first_word()` may return positive value on success.

(cherry picked from commit 6a35d52d786137f8f955d41dbc505a818169d904)
(cherry picked from commit 900af2155833107e502feade072694b402aa831e)
2022-07-13 13:30:45 +02:00
Yu Watanabe
79d9afd3d6 resolve: fix possible integer overflow
(cherry picked from commit 370999c05bd21b18056686dfb27f999acda7c0b6)
(cherry picked from commit b7fc4ffe9747b7a967b43cbff5a96286976946ee)
2022-07-13 13:30:45 +02:00
Yu Watanabe
63c0ce2346 resolve: fix heap-buffer-overflow reported by ASAN with strict_string_checks=1
Fixes #23942.

(cherry picked from commit beeab352de413e1c04de0a67ee36525fcf6e99dd)
(cherry picked from commit feb244676baa246e660b713544c2cb8766c25b34)
2022-07-13 13:30:45 +02:00
Yu Watanabe
c32530f5bd time-util: fix buffer-over-run
Fixes #23928.

(cherry picked from commit 9102c625a673a3246d7e73d8737f3494446bad4e)
(cherry picked from commit 72d4c15a946d20143cd4c6783c802124bc894dc7)
2022-07-13 13:30:45 +02:00
Lennart Poettering
9e9d8b8ef7 tmpfiles: correct error variable to use
(cherry picked from commit 149e0ca6c77692b82a9e4602ca4ffb7108346379)
(cherry picked from commit 9e73f919abad4166214c704bbd2cde9ea0e5614b)
2022-07-13 13:30:45 +02:00
Lennart Poettering
859f107020 namespace: fix propagated error number
(cherry picked from commit 1ce268c7892be2221bec6bf5ef795a82df92e48f)
(cherry picked from commit c377dc4832083dfd7bd42fc9fbad9f0e0e7a8bf8)
2022-07-13 13:30:45 +02:00
Lennart Poettering
2317d49cfb man: "enabled commands are started at boot" is rubbish
it's enabled units, and they might be started by various forms of
activation, not just "at boot".

Fix that.

(cherry picked from commit 0c772b1cc1f08bee260addbecb8adc6cdf4ddeef)
(cherry picked from commit 81d33ab7f60a5fe672f3869d97bf4e007aa49510)
2022-07-13 13:30:44 +02:00
Lennart Poettering
84715375d5 json: actually use numeric C locale we just allocated
This fixes formatting of JSON real values, and uses C locale for them.
It's kinda interesting that this wasn't noticed before: the C locale
object we allocated was not used, hence doing the dance had zero effect.

This makes "test-varlink" pass again on systems with non-C locale.

(My guess: noone noticed this because "long double" was used before by
the JSON code and that had no locale supporting printer or so?)

(cherry picked from commit 93258c7d72fae23c9f8103c98dd0e79a24838e26)
(cherry picked from commit 2e6e30a92f5a36f84cf068f2b3c31ced7d7a9865)
2022-07-13 13:30:44 +02:00
Lennart Poettering
aa65f1f24f sd-id128: don't allow chars > f in valid id128 values
(cherry picked from commit 82c3a0b74c8decccf2e1e384e7ad02def4a07459)
(cherry picked from commit 6e6da09bd0138a2570f01022530dd81f62d417e3)
2022-07-13 13:30:44 +02:00
Yu Watanabe
256ce35963 nspawn: support PrivateUsers=identity
Follow-up for 33eac552ab22af58b303342b1fa912900fa42820.

Fixes #23825.

(cherry picked from commit 5ad08191d85d6dd058b9d07ccf37ae4b709564e5)
(cherry picked from commit 5478878067e8e06b8150a418f07c6874761c3515)
2022-07-13 13:30:44 +02:00
Yu Watanabe
c094ef34a6 journalctl: fix to show user slice
Fixes #23867.

(cherry picked from commit 3daf1f913c3bcf500f2c7e2b186185090c495256)
(cherry picked from commit 9d86a5ac92361896673ff74c3ca2350ebe522879)
2022-07-13 13:30:44 +02:00
Daan De Meyer
001d00ac69 journal: Fix missing parenthesis
(cherry picked from commit f63d1b0efa64fe716c2855a0410ac47ad67f7dec)
(cherry picked from commit 437978fe51983d39cd2fc6437a1152761b7f6f6d)
2022-07-13 13:30:44 +02:00
Yu Watanabe
a53e5e0e2f virt: fix detection of Parallels virtualization
If Parallels virtualization is detected from DMI, then trust that over CPUID.

Fixes issue caused by 28b1a3eac252d471de4fbb6f317353af30d68878.

Fixes #23856.

(cherry picked from commit 840a49f3dcee9a5243f9a31ede2edaa0a3b89e26)
(cherry picked from commit 0c36233a84c0f6c9b46523390960e60a9adae37c)
2022-07-13 13:30:44 +02:00
Yu Watanabe
2e54ed4043 sd-event: make sd_event_prepare() return positive when buffered inotify data exists
Previously, even if there is buffered inotify data, sd_event_prepare()
did not process the data when there is no pending event source.

Fixes #23826.

(cherry picked from commit 067fc917026fd1fe601de0198c5ea7b3ba782d1e)
(cherry picked from commit 632ba5b2f09646152feef0182cc94fe1b05e15ed)
2022-07-13 13:30:44 +02:00
Zbigniew Jędrzejewski-Szmek
29e3dc0dfd test-sd-hwdb: adjust the test to actually do anything
Without the terminating colon we wouldn't match anything, so the loop over
properties was skipped.

(cherry picked from commit 6b0485c29a28aa238cfd8ccf123bf6f4ff3507f2)
(cherry picked from commit 09e0ccf29327be2c27ed3e7b87e072180dd9d18d)
2022-07-13 13:30:44 +02:00
Jacek Migacz
2772e75771 emacs: ignore .dir-locals-2.el (personal customization) versioning
(cherry picked from commit 25e17bddec601b97516a071c6ee73060abc8b09c)
(cherry picked from commit 596dc75d18b75deec53d0c5026fda41589007c6c)
2022-07-13 13:30:44 +02:00
Yu Watanabe
a87e130a45 udev: allow to execute longer command line
Fixes #23607.

(cherry picked from commit c3613ee51e3aff61dfea22501c48d19c20cb7b71)
(cherry picked from commit 0c5b7ee3187e96b3522610a7dce980f8c9e1160d)
2022-07-13 13:30:44 +02:00
Alban Bedel
639423416c units: remove the restart limit on the modprobe@.service
They are various cases where the same module might be repeatedly
loaded in a short time frame, for example if a service depending on a
module keep restarting, or if many instances of such service get
started at the same time. If this happend the modprobe@.service
instance will be marked as failed because it hit the restart limit.

Overall it doesn't seems to make much sense to have a restart limit on
the modprobe service so just disable it.

Fixes: #23742
(cherry picked from commit 9625350e5381a68c1179ae4581e7586c206663e1)
(cherry picked from commit 8539a62207c9d0cc1656458eb53ffc9177b2c7c8)
2022-07-13 13:18:28 +02:00
Pavel Zhukov
6785d1aa74 Add sys/file.h for LOCK_
Fixes build with musl:
| ../git/src/shared/dissect-image.c: In function 'mount_image_privately_interactively':
| ../git/src/shared/dissect-image.c:2986:34: error: 'LOCK_SH' undeclared (first use in this function)
|  2986 |         r = loop_device_flock(d, LOCK_SH);
|       |                                  ^~~~~~~

(cherry picked from commit 19df770fe14da601d4e54e1592c11c10ffe4df5a)
(cherry picked from commit b7773908142cf158e959302de43dea148a02ebf8)
2022-07-13 13:18:23 +02:00
Zbigniew Jędrzejewski-Szmek
ee2ecdff71 pkgconfig,rpm: expose vars for user-tmpfiles.d location
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2098553.

(cherry picked from commit 107795a7592084699f68125f3d79c25a0ebca819)
(cherry picked from commit a82d8d19161f7dac971738f25a77aa9f188ecc03)
2022-07-13 13:18:20 +02:00
Frantisek Sumsal
dcd77da1f4 test: use saved process PID instead of %%
As the `%%` specifier might fail if the current job (i.e. the last
background job) already finished:

```
[   61.692196] testsuite-04.sh[656]: ++ systemd-id128 new
[   61.705407] testsuite-04.sh[263]: + ID=912cb8f8ef304153a123f772bb0fe9e0
[   61.706318] testsuite-04.sh[657]: + systemd-cat -t 912cb8f8ef304153a123f772bb0fe9e0 bash -c 'echo parent; (echo child) & wait'
[   61.720940] testsuite-04.sh[263]: + PID=657
[   61.721126] testsuite-04.sh[263]: + wait %%
[   61.723014] testsuite-04.sh[263]: /usr/lib/systemd/tests/testdata/units/testsuite-04.sh: line 96: wait: %%: no such job
```

(cherry picked from commit 08970485003c25ce2c4adfaeea2d58558d311d42)
(cherry picked from commit 9facc51e2f510e58f496d1a7f3714786b4307605)
2022-07-13 13:18:16 +02:00
Marc Kleine-Budde
39a47af2e5 networkctl: fix output of "status": replace "Queue Length" by "Number of Queues"
Commit 0307afc681e1 ("networkctl: add support to display Transmit/Recieve queue
length (#12633)") added the display of the number of RX and TX Queues to the
output of `networkctl status $DEV`. However the row description says "Queue
Length".

This patch fixes the output by replacing "Queue Length" by "Number of Queues".

Fixes: 0307afc681e1 ("networkctl: add support to display Transmit/Recieve queue length (#12633)")
(cherry picked from commit 25ed7633b1d231acf61246bbdca29faa80d7f00f)
(cherry picked from commit 16b8ae51b0eca798ad595f84de0dd4f392eff0ea)
2022-07-13 13:18:13 +02:00
Yu Watanabe
ba1d285ed0 seccomp-util: make @known include @obsolete
@known is generated from syscall-list.txt, which generated from kernel
headers. So, some syscalls in @obsolete may not be listed in
syscall-list.txt.

(cherry picked from commit 6d6a08547c03f96dc798cda1ef4a8d3013d292d5)
(cherry picked from commit 996979f5137d3a890acec39f427019721a4add1d)
2022-07-13 13:18:09 +02:00
Yu Watanabe
c96ff736c6 analyze-security: always save syscall name
This reverts dd51e725df9aec2847482131ef601e0215b371a0 and fixes bugs
introduced by 1624114d74f55ad9791b7624b08d89d2339a68b3.

Previously,
- On online scan, the syscall filter was a string Hashmap, but it
  might contain syscall name with errno or error action. Hence, we need
  to drop the errno or error action in the string.
- On offline scan, the syscall filter was a Hashmap of syscall ID, so
  hashmap_contains() with syscall name did not work. We need to convert
  syscall IDs to syscall names.
- If hashmap_contains() in syscall_names_in_filter() is true, then
  the syscall is allowed when the list is an allow-list, and vice versa.
  Hence, the condition in syscall_names_in_filter() was errnously
  inverted by dd51e725df9aec2847482131ef601e0215b371a0.

This makes syscalls are always stored with its name, instead of ID,
and also correct the condition.

Fixes #23663.

(cherry picked from commit 5862e5561c9bbe87ad201e8d6b2ce2d0f04e7c37)
(cherry picked from commit 20a265b4160c5c0bbfeed2a9e8a1ca0b41f8edc3)
2022-07-13 13:18:04 +02:00
Yu Watanabe
89c1fccb1e set: introduce set_put_strndup()
Note, if `n != SIZE_MAX`, we cannot check the existence of the specified
string in the set without duplicating the string. And, set_consume() also
checks the existence of the string. Hence, it is not necessary to call
set_contains() if `n != SIZE_MAX`.

(cherry picked from commit cb649d12bf3283974305c98ecf51e4bf7596a8bf)
(cherry picked from commit a64c080ccf0e854c005798870783f3f02a3d843c)
2022-07-13 13:16:33 +02:00
Yu Watanabe
074e76f211 nspawn: fix UID map string
We send/recv the set of payload uid, host uid, payload gid, host gid.
Hence, the index must be incremented with 4, instead of 2.

Fixes #23664.

(cherry picked from commit 05ab439a62de8bb47e4137d2a8a473a307ccfb33)
(cherry picked from commit 20037219b702dd34b9b34050bf64030d4f93db98)
2022-07-13 13:16:28 +02:00
Shreenidhi Shedi
6bd461a55e sd-journal: check retval of sd_id128_from_string call
Fixes: CID#1469712

CID 1469712 (#1 of 1): Unused value (UNUSED_VALUE)
returned_value: Assigning value from sd_id128_from_string(word + 2, &boot_id) to r here,
but that stored value is overwritten before it can be used.

(cherry picked from commit c9f5ac0917409cd9eb3d55b72c2443d9b5374709)
(cherry picked from commit 73a327d2f4cca00bdca61ee4f1103ad120b74368)
2022-07-13 13:16:24 +02:00
Jan Luebbe
f2b1c270bc hwdb: analyzers: remove generic "STM Device in DFU Mode"
The USB ID v0483pDF11 is used by the ROM code in many STMicroelectronics
devices (for firmware download) and not just signal analyzers.

(cherry picked from commit 5d049ff9204b9aad48c62c296def4daa4b53005e)
(cherry picked from commit adcd34515687e7e150d71d2ee45da74208d26f2f)
2022-07-13 13:15:56 +02:00
Yu Watanabe
51c18be68d dns-domain: make each label nul-terminated
dns_label_unescape() does not nul-terminate the buffer if it does not
have enough space. Hence, if a lable is enough long, then strjoin()
triggers buffer-overflow.

Fixes #23705.

(cherry picked from commit 9db01ca5b0322bc035e1ccd6b8a0d98a26533b4a)
(cherry picked from commit 25158b294482f793f962e8ee5f34e99a01214321)
2022-07-13 09:44:20 +02:00
Zbigniew Jędrzejewski-Szmek
947ddf732a test-nspawn-util: fix the test to actually find anything
We would use a relative path, looking for globs like
'lib/systemd/libsystemd-shared-*.so' under the build directory, and never find
anything.

The test was supposed to find library in the current installation. But we
cannot assume that the right library is installed, so the test only printed the
result for manual inspection. Thus nobody noticed when it broke. I think it
broke in c6134d3e2f1d1d17b32b6e06556cd0c5429bc78a, path-util: get rid of prefix_root().
But that commit doesn't compile because of changes in meson, so this is just
a guess.

Before:
/* test_systemd_installation_has_version */
Current installation has systemd >= 0: no
Current installation has systemd >= 231: no
Current installation has systemd >= 249: no
Current installation has systemd >= 999: no

With the fix:
$ build/test-nspawn-util
/* test_systemd_installation_has_version */
Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (OK).
Current installation has systemd >= 0: yes
Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (OK).
Current installation has systemd >= 231: yes
Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (too old).
Found libsystemd shared at "/lib/systemd/libsystemd-shared-251.so.so", version 251 (OK).
Current installation has systemd >= 251: yes
Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (too old).
Found libsystemd shared at "/lib/systemd/libsystemd-shared-251.so.so", version 251 (too old).
Found libsystemd shared at "/lib/systemd/libsystemd-shared-250.so.so", version 250 (too old).
Found libsystemd shared at "/usr/lib/systemd/libsystemd-shared-245.so.so", version 245 (too old).
Found libsystemd shared at "/usr/lib/systemd/libsystemd-shared-251.so.so", version 251 (too old).
Found libsystemd shared at "/usr/lib/systemd/libsystemd-shared-250.so.so", version 250 (too old).
Current installation has systemd >= 999: no

$ build/test-nspawn-util /var/lib/machines/rawhide
/* test_systemd_installation_has_version */
/* test_systemd_installation_has_version */
Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (OK).
/var/lib/machines/rawhide has systemd >= 0: yes
Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (OK).
/var/lib/machines/rawhide has systemd >= 231: yes
Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (OK).
/var/lib/machines/rawhide has systemd >= 251: yes
Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (too old).
Found libsystemd shared at "/var/lib/machines/rawhide/usr/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (too old).
/var/lib/machines/rawhide has systemd >= 999: no

While at it, NULSTR_FOREACH → FOREACH_STRING.

(cherry picked from commit 0643001c2838d244a8698ea782414115034804bc)
2022-07-11 20:54:18 +09:00
Zbigniew Jędrzejewski-Szmek
88631ec544 nspawn: fix comparisons of versions with non-numerical suffixes
See a2b0cd3f5ab3f450e74e2085ad20372a05451c74. When -Dshared-lib-tag is used,
libsystemd-shared.so and libsystemd-core.so get a suffix which breaks the
parsing done by systemd_installation_has_version(). We can assume that the
tag will be something like "251-rc1-1.fc37" that is currently used in Fedora.
(Anything that does *not* start with the version would be completely crazy.)
By switching to strverscmp_improved() we simplify the code and fix comparisons
with such versions.

$ build/test-nspawn-util /var/lib/machines/rawhide
...
Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251-rc1-1.fc37 (OK).
/var/lib/machines/rawhide has systemd >= 251: yes
...

I noticed this when I started a systemd-nspawn container with Redora rawhide
and got the message "Not running with unified cgroup hierarchy, LSM BPF is not
supported". I thought the message is in error, but it was actually correct:
nspawn was misdetecting that the container does not sport new-enough systemd
to support cgroups-v2.

(cherry picked from commit 7e6821ed4e09d68c45858ba463a013eb7593c2c6)
2022-07-11 20:54:18 +09:00
Zbigniew Jędrzejewski-Szmek
8f46abbd8e Move systemd_installation_has_version() to src/nspawn/
This function implements a heuristic that is only used by nspawn. It doesn't
belong in basic. I opted for a new file "nspawn-utils.c", because it seems
likely that we'll need some other new utilities like that in the future.

No functional change.

(cherry picked from commit c9394f4f93b9a6baa54f9d1c953035f26dcee253)
2022-07-11 20:54:18 +09:00
Yu Watanabe
e74e1dc8cc network: create stacked netdevs after the underlying link is activated
Otherwise, the activation policy for the netdevs are ignored.

Fixes #22593.

(cherry picked from commit 047b9991a4d0d93d0dfe3d144410c619a8b74699)
2022-06-12 11:49:27 +02:00
Yu Watanabe
28390fa984 network: do not enable IPv4 ACD for IPv4 link-local address if ACD is disabled explicitly
The commit 1cf4ed142d6c1e2b9dc6a0bc74b6a83ae30b0f8e makes the IPv4 ACD
enabled unconditionally for IPv4 link-local addresses even if users
explicitly disable ACD.

This makes the IPv4 ACD is enabled by default, but honor user setting.

Fixes #22763.

(cherry picked from commit 2859932bd64d61a89f85fa027762bc16961fcf53)
2022-06-10 08:14:31 +09:00
Luca Boccassi
cfe1936465 analyze: fix crash with online security check
1449b0f8a96b27 fixed seccomp arch check for the offline case,
but broke it for the normal case, as when coming from D-Bus the
list of seccomp architectures is already converted to string.

Fixes https://github.com/systemd/systemd/issues/23224

(cherry picked from commit e22f2cfa5e79135d9abf53152a292357fe807dc9)
2022-06-10 08:13:31 +09:00
Zbigniew Jędrzejewski-Szmek
77fabe49e1 meson: also check c_args to maybe add -Wno-maybe-uninitialized
People (and build systems) sometimes set flags through -Dc_args=… or $CFLAGS.
Let's catch this common case too. meson will set c_args from $CFLAGS, so we
only need to check the former.

(cherry picked from commit b528a62863961658165091985b565cf7be48ea98)
2022-06-09 17:47:50 +02:00
Yu Watanabe
39f2ccdb37 tree-wide: fix typo
(cherry picked from commit a17e54783a6c899309bd5e32f1d68e95a0db0abf)
2022-06-09 17:47:50 +02:00
Zbigniew Jędrzejewski-Szmek
51089e007f Revert "stat-util: optimize dir_is_empty_at() a bit, by using getdents64()"
This reverts commit a068aceafbffcba85398cce636c25d659265087a.

https://github.com/systemd/systemd/pull/23236 fixes a regression introduced
by this patch. But there was a bunch of follow-ups, and unrelated fixups…
So let's just revert this instead.
2022-06-09 17:47:50 +02:00
Zbigniew Jędrzejewski-Szmek
c46b908d6e Revert "tree-wide: explicitly unpoison getdents64() memory"
This partially reverts commit 0dbce03c37d1e11837dd7f9b80b9964ca539c914.
2022-06-09 17:33:19 +02:00
Yu Watanabe
666d792e85 network: do not update interface group by default
This fixes a minor bug introduced by 10af8bb24b39a815079f6bf31b449c6e5aaa2adf.
Before the commit, the interface group was set only when Group= is explicitly
specified, otherwise the interface group was kept. However, after the commit,
we need to specify Group= with an empty string to keep the current interface
group.

(cherry picked from commit cee683394328ae271348fad93c3474b5784bcc78)
2022-06-09 17:24:40 +02:00