Commit graph

61936 commits

Author SHA1 Message Date
Lennart Poettering
03469b770b shared: port various shared helpers basename() → path_extract_filename() 2022-12-23 17:35:21 +01:00
Lennart Poettering
ce7dcfd6b0 units: pull in loop.ko and dm-mod.ko before repart
We want to make use of that when formatting file systems, hence let's
pull in these modules explicitly.

(This is necessary because we are an early boot service that might run
before systemd-tmpfiles-dev.service, which creates /dev/loop-control and
/dev/mapper/control.)

Alternatively we could just order ourselves after
systemd-tmpfiles-dev.service, but I think there's value in adding an
explicit minimal ordering here, since we know what we'll need.

Fixes: #25775
2022-12-23 17:26:57 +01:00
Lennart Poettering
143a1f1039 units: change modprobe@dm-mod.service → modprobe@dm_mod.service
Follow-up for 8f1359bf85
2022-12-23 17:26:48 +01:00
Lennart Poettering
7b2ffb593e repart/makefs: port over to path_extract_filename() 2022-12-23 15:04:19 +01:00
Lennart Poettering
7e763f9402 portable: port basename() → path_extract_filename() 2022-12-23 15:04:19 +01:00
Lennart Poettering
b36e39d2eb nspawn: port over basename() → path_extract_filename() 2022-12-23 15:04:19 +01:00
Lennart Poettering
451f0dba60 mount-tool: port over basename() → path_extract_filename() 2022-12-23 15:04:19 +01:00
Lennart Poettering
72d95a18c1 journalctl: port COMM= matching to path_extract_filename() 2022-12-23 15:04:19 +01:00
Lennart Poettering
83802e9abd dissect: remove one more use of basename()
And while we are at it, make use of path_extract_filename() return value
that indicates whether the path was suffixed with a slash.
2022-12-23 15:04:19 +01:00
Lennart Poettering
a99626c11a core: move some basename() use → path_extract_filename() 2022-12-23 15:04:19 +01:00
Lennart Poettering
0eb2f0a2fc tests: we don't actually use basename() anymore 2022-12-23 15:04:19 +01:00
Lennart Poettering
c96c9fc78e homed: move away from basename() 2022-12-23 15:04:19 +01:00
Jia Zhang
c2c38276cb measure: fix the failures of compare_reported_pcr_nr()
EFI_LOADER_VARIABLE() already applies to the stringify to construct the
path of EFI variable in efivars, so it is wrong to enclose the name of
EFI variable with the quotes. Otherwise, the following errors are
reported.

Reading EFI variable /sys/firmware/efi/efivars/StubFeatures-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
Reading EFI variable /sys/firmware/efi/efivars/"StubPcrKernelImage"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
open("/sys/firmware/efi/efivars/"StubPcrKernelImage"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f") failed: No such file or directory
Reading EFI variable /sys/firmware/efi/efivars/"StubPcrKernelParameters"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
open("/sys/firmware/efi/efivars/"StubPcrKernelParameters"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f") failed: No such file or directory
Reading EFI variable /sys/firmware/efi/efivars/"StubPcrInitRDSysExts"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
open("/sys/firmware/efi/efivars/"StubPcrInitRDSysExts"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f") failed: No such file or directory

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2022-12-23 14:41:33 +01:00
Yu Watanabe
2b22355075
Merge pull request #25823 from poettering/dissect-diskseq
gpt-auto: reference dissected partitions to mount via diskseq block device symlinks
2022-12-23 22:11:59 +09:00
Yu Watanabe
26c45a6c1d tree-wide: have_effective_cap() may return negative errno 2022-12-23 22:11:00 +09:00
Yu Watanabe
d7301331e8
Merge pull request #25830 from yuwata/wait-online-unmanaged
wait-online: exit with success when all interfaces are ready or unmanaged
2022-12-23 22:10:38 +09:00
Lennart Poettering
71eaa9291d
Merge pull request #25777 from PeterCxy/enroll-fido2
cryptenroll: Implement support for unlocking via FIDO2 tokens
2022-12-23 13:14:14 +01:00
Lennart Poettering
309bba96d6 update TODO 2022-12-23 12:44:57 +01:00
Lennart Poettering
8716a76ce2 gpt-auto-generator: enable referencing partitions via diskseq symlinks 2022-12-23 12:44:57 +01:00
Lennart Poettering
1a81ddef00 dissect-image: optionally, reference dissected partition device nodes by diskseq
This is useful to make the dissection logic at boot a bit safer, as we
can reference device nodes by diskseq.

This locks down dissection a bit, since it makes it harder to swap out
the backing device between the time we dissected and validated it, until
we actually mounted it.

This is not complete though, as /bin/mount would have to verify the
diskseq after opening the diskseq symlink again.

See: https://github.com/util-linux/util-linux/issues/1786
2022-12-23 12:44:57 +01:00
Lennart Poettering
a559088671 dissect-image: simplify things by avoiding one string copy
We don't need the node in its original variable anymore, hence let's
just move it over instead of allocating a copy.
2022-12-23 12:42:37 +01:00
Lennart Poettering
583dc6d933 udev: also create partition /dev/disk/by-diskseq/ symlinks 2022-12-23 12:42:37 +01:00
Lennart Poettering
13b99dccb7 import-creds: don't try to import VM creds in a container
If we run in a container we shouldn#t try to import creds passed in from
a VMM, as they are not for us, but for the VM itself.
2022-12-23 00:46:41 +01:00
Peter Cai
48765191d2 cryptenroll: Implement support for unlocking via FIDO2 tokens
This allows FIDO2 users to wipe out password slots and still be able to
enroll new key slots via systemd-cryptenroll. Note that when the user
wants to both unlock with a FIDO2 token and enroll a new FIDO2 token,
they cannot be set to automatic discovery. This is to safeguard against
confusion, because there will be multiple tokens connected to the system
when doing so -- and we require users to explicitly confirm which one to
use for unlocking and which one to use for enrollment.

Addresses #20230 for the FIDO2 case.
2022-12-22 17:33:25 -05:00
Luca Boccassi
21c8d750cd
Merge pull request #25814 from DaanDeMeyer/ukify
ukify: Prefer using llvm-objcopy instead of objcopy
2022-12-22 22:19:05 +01:00
Peter Cai
52105bb487 cryptsetup-fido2: Remove plain mode parameters from acquire_fido2_key_auto()
`acquire_fido2_key_auto()` will not be used in PLAIN mode, and
parameters such as the salt will be acquired from the LUKS header.
Parameters intended for PLAIN mode are useless in
`acquire_fido2_key_auto()`.
2022-12-22 11:20:56 -05:00
Peter Cai
0a8e026e82 cryptsetup-fido2: Relocate to libsystemd-shared 2022-12-22 08:43:50 -05:00
Daan De Meyer
3fc1ae89e7 ukify: Validate that there are no overlapping sections
Let's make sure that after calling objcopy we have no overlapping
sections in the UKI
2022-12-22 12:21:11 +01:00
Daan De Meyer
789a642738 ukify: Prefer using llvm-objcopy instead of objcopy
llvm-objcopy works on stubs built for foreign architectures whereas
objcopy doesn't so let's prefer using llvm-objcopy instead of objcopy.

llvm-objcopy automatically sets the virtual address and doesn't provide
an option to set it manually so we only add --change-section-vma when
using objcopy

The default section flags differ between llvm-objcopy and objcopy
so we add a default for the section flags so we make sure all sections
are read-only data unless specified otherwise.
2022-12-22 12:20:24 +01:00
Daan De Meyer
22ad038ac6 ukify: Allow passing multiple directories to --tools 2022-12-22 12:19:55 +01:00
Luca Boccassi
27ce258c54
Merge pull request #25791 from keszybz/ukify-check-inputs
ukify: check inputs
2022-12-22 12:10:32 +01:00
Yu Watanabe
9c29d87bee macro: check existence of cleanup function before call it
The free function specified in the macro may be provided by a
dynamically loaded library.

Replaces #25781.
2022-12-22 10:59:26 +01:00
Yu Watanabe
56dfde0d54 test-network: add testcase for no managed interface 2022-12-22 16:42:55 +09:00
Yu Watanabe
b09ec84700 test-network: split out wait-online related test case 2022-12-22 16:29:20 +09:00
Yu Watanabe
5432adae82 test-network: move one test case 2022-12-22 16:27:58 +09:00
Lennart Poettering
80ce8580f5 dissect-image: let's lock down fstypes a bit
When we dissect images automatically, let's be a bit more conservative
with the file system types we are willing to mount: only mount common
file systems automatically.

Explicit mounts requested by admins should always be OK, but when we do
automatic mounts, let's not permit barely maintained, possibly legacy
file systems.

The list for now covers the four common writable and two common
read-only file systems. Sooner or later we might want to add more to the
list.

Also, it might make sense to eventually make this configurable via the
image dissection policy logic.
2022-12-22 10:30:35 +09:00
Yu Watanabe
e20bae24d1
Merge pull request #25829 from poettering/empty-to-null-const-fix
string-util: don't add `const` to return pointer of empty_to_null() if input didn't have it
2022-12-22 10:29:59 +09:00
Yu Watanabe
ab3aed4a03 wait-online: exit with success when all interfaces are ready or unmanaged
Previously, when neither '--any' nor '--interface' options specified,
at least one of the interfaces must be in configured state.
This patch makes wait-online exit with success even if all interfaces
are in unmanaged state.

This may break backward compatibility in a rare situation. But in most
cases, this typically not change anything, as at least one interface
is managed by networkd.service when it is enabled.

This is mostly for making wait-online gracefully handle the case that
networkd.service and wait-online.service are enabled by mistake. In such
situation, all interfaces are typically not managed.

Fixes #25813.
2022-12-22 09:40:46 +09:00
Lennart Poettering
c6661401a7 creds: use empty_or_dash() where appropriate 2022-12-21 22:47:47 +01:00
Lennart Poettering
ef2409cbde string-util: rework empty_to_null() to not change "const" qualifier of input
This changes the definition from enpty_to_null() so that we are still
typesafe (i.e. only accept strings) but do not drop (or add) any const
to the returned string that wasn't also on the input.

Inspired by: 3196e2996f
2022-12-21 22:41:16 +01:00
Lennart Poettering
cf451f382a gpt-auto-generator: honour rootfstype= and rootflags= kernel cmdline option
Even if root= is not specified on the kernel cmdline, we should honour
the other rootXYZ= options.

Fixes: #8411
See: #17034
2022-12-21 22:15:02 +01:00
Hans de Goede
ec6267e862 hwdb: Add mic-mute, control-center and screen-rotation mappings for MSI laptops
The MSI Summit E16 Flip A12UCT laptop sends the following unmapped
atkbd scancodes:

0x91: Launch MSI Control Center
0xf1: Toggle mic mute
0xf2: Rotate screen

The 0x91, 0xf1 and 0xf2 codes are already present in the MSI Prestige/Modern
series specific keymappings and the 0xf1 mapping is also already present in
the MSI Bravo 15-B5DX FnKeys entry.

This shows that these are generic to many MSI models, so add mappings for
these to the generic MSI mappings.

Since the MSI Bravo 15-B5DX FnKeys entry only contains the 0xf1 mapping and
that is covered by the generic MSI mappings now, that entry is removed.

Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/822
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216824
2022-12-22 05:40:05 +09:00
Philipp Jungkamp
71a639db68 hwdb: change definition of PROXIMITY_NEAR_LEVEL for sensors
The [kernel documentation][0] for the in_proximity_nearlevel sysfs
attribute on iio proximity devices states:

    If the value read from the sensor is above or equal to the value in
    this file an object should typically be considered near.

Meaning a 'greater than or equal to' comparison.

Make the documentation comment in 60-sensors.hwdb suggest a
greater-or-equal rather than a strict greater-than comparison.

[0]: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio-proximity

Fixes #25793
2022-12-22 05:31:04 +09:00
Antonio Alvarez Feijoo
09ed55c26d systemctl: fix typo 2022-12-21 19:34:25 +09:00
Yu Watanabe
de8409ac43 rules: add missing line continuation
Fixes a bug introduced by 953c928c24.

Fixes #25811.
2022-12-21 09:52:07 +01:00
Steve Ramage
df7f714acc
man: create a new section for nspawn files in systemd.syntax man page (#25807)
Closes #25806.
2022-12-21 13:31:09 +09:00
Jacek Migacz
8b23242989 resolve: fix enumerator name for DNS search domain 2022-12-20 19:02:18 +01:00
Lennart Poettering
5948d654fa
Merge pull request #25789 from yuwata/EBADF
tree-wide: use -EBADF more
2022-12-20 19:01:54 +01:00
Zbigniew Jędrzejewski-Szmek
b764142565 Merge branch 'systemd-security/coredump-capabilities'
CVE-2022-4415: systemd: coredump not respecting fs.suid_dumpable kernel setting
Affects systemd >= 247 with libacl support enabled.

This is a merge of https://github.com/systemd/systemd-security/pull/12/.
I'm doing the merge locally because github doesn't support merging directly
from systemd/systemd-security to systemd/systemd.
2022-12-20 17:56:28 +01:00
Yu Watanabe
5bb1d7fbab tree-wide: use -EBADF more 2022-12-21 01:50:33 +09:00