1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-09 12:58:26 +03:00

61758 Commits

Author SHA1 Message Date
msizanoen1
9cd80d8a58 test-journal-flush: don't fail on -EREMCHG
-EREMCHG on write is now used to denote clock rollback conditions
detected during journal write.
2023-01-09 22:57:50 +07:00
msizanoen1
1d8d483f59 journal: enforce strict consistency for realtime timestamps on write
Ensure all realtime timestamps in a journal file are strictly
ordered on write as a defense-in-depth measure. All known callers of
journal_file_append_entry and journal_file_copy_entry, which call this
function, should be able to handle the error by rotating the journal.

This is especially helpful for systems with RTC local time enabled,
where all log entries from initramfs might be recorded as several hours
later than it actually is, which won't get caught by journald during log
flushing. In those cases, the resulting inconsistency can cause libsystemd
to loop infinitely through journal files as observed in
`abrt-dump-journal-oops`.
2023-01-09 22:57:30 +07:00
Luca Boccassi
7900968527
Merge pull request #25864 from yuwata/dissect-fix-mtree
dissect: fix mtree
2022-12-26 17:43:27 +01:00
Hannoskaj
cb6f38b182 Prevents airplane mode toggle for HP Spectre 16 2022-12-26 21:08:24 +09:00
Jia Zhang
486cf22c35 boot: don't convert the trailing newline in mangle_stub_cmdline()
It is pretty convenient to add .cmdline using /proc/cmdline like
this:
  --add-section .cmdline=/proc/cmdline --change-section-vma .cmdline=0x25000

However, it always returns a trailing newline, and stub will
convert it to a whitespace by mangle_stub_cmdline() in next boot.
Thus the resulting /proc/cmdline would contain a trailing
whitespace. When /proc/cmdline is used to generate .cmdline again,
the resulting UKI is mangled.

To address this kind of inconvenience, mangle_stub_cmdline() should
skip converting the trailing newline, and try to chomp all the
trailing whitespaces.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2022-12-26 19:12:23 +09:00
Yu Watanabe
01a33cf7e8 dissect: reduce indent in mtree_print_item() 2022-12-26 16:42:29 +09:00
Yu Watanabe
5ffa6a0af4 dissect: do not trigger assertion on error
recurse_dir() does not provide 'sx' on error.

Fixes #25862.
2022-12-26 16:42:29 +09:00
Yu Watanabe
167f2c1a2b dissect: use assert() when no side effect 2022-12-26 16:42:29 +09:00
Lennart Poettering
5c8e19cc1c
Merge pull request #25850 from poettering/switch-root-tweaks-minor
pid1: minor tweaks to the SwitchRoot() logic
2022-12-24 11:20:02 +01:00
Yu Watanabe
20ada51464
Merge pull request #25828 from poettering/no-more-basename
convert a number of basename() invocations to path_extract_filename()
2022-12-24 08:13:00 +09:00
Lennart Poettering
8656f4a6ae prioq: make prioq_reshuffle() void
We never use the return value, and it's confusing and kinda pointless
what we return there.

Hence drop it.

Originally noticed by: tristone13th <tristone13th@outlook.com>

Alternative to: #25810
2022-12-23 23:26:26 +01:00
Lennart Poettering
b892124bdc
Merge pull request #25849 from poettering/repart-loop
pull in loop.ko from repart unit
2022-12-23 23:26:00 +01:00
Lennart Poettering
6ae5c39af1 docs: remove /dev/tty* confusion
The text said /dev/tty* as a whole was the VT subsystem and that VT is
not supported in containers.

But that's not accurate as /dev/tty* will match /dev/tty too and that
one device node is special and is not related to VT: it always points to
the current process own controlling tty, regardless what that is.

hence, rewrite /dev/tty* as /dev/tty[0-9]*.
2022-12-23 21:17:31 +01:00
Will Fancher
0941ccae3c sysroot: Order systemd-fsck-root after systemd-makefs 2022-12-23 18:34:09 +01:00
Lennart Poettering
457bbbce7b systemctl: rework how we detect if init is systemd 2022-12-23 18:29:35 +01:00
Lennart Poettering
e10086ac01 core: use chase_symlinks_and_access() where appropriate 2022-12-23 18:09:02 +01:00
Lennart Poettering
5f4c9c27d8 core: tighten validation checks in SwitchRoot() dbus call 2022-12-23 18:09:02 +01:00
Lennart Poettering
937362e02c lock-file: various updates 2022-12-23 17:35:21 +01:00
Lennart Poettering
020b66d850 analyze: basename() → path_extract_filename() 2022-12-23 17:35:21 +01:00
Lennart Poettering
d0242ac946 format-table: add field type TABLE_PATH_BASENAME
This is just like TABLE_PATH, but only shows the basename in regular
tabular output.

This is useful in systemd-repart for example
2022-12-23 17:35:21 +01:00
Lennart Poettering
a67bacff34 tmpfiles: port basename() → path_extract_filename() 2022-12-23 17:35:21 +01:00
Lennart Poettering
1d8a8a7dee sysv-generator: port basename() → path_extract_filename() 2022-12-23 17:35:21 +01:00
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 8f1359bf854e9683e4e0b89fd3a537e0d82d4b95
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