1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00
Commit Graph

63359 Commits

Author SHA1 Message Date
Jan Janssen
3fc5eed470 ukify: Use pefile to add sections to EFI stub 2023-03-24 13:01:45 +01:00
Frantisek Sumsal
aadbd81f7f test: add a couple of tests for systemd-coredump 2023-03-24 11:56:33 +01:00
Daan De Meyer
12962485e4
Merge pull request #26958 from yuwata/nulstr-optionally-drop-trailing-nulstr
nulstr: make strv_parse_nulstr() optionally drop trailing NULs
2023-03-24 11:33:58 +01:00
Daan De Meyer
d258aacdfb
Merge pull request #26957 from yuwata/proc-cmdline-cleanups
proc-cmdline: several cleanups
2023-03-24 11:29:54 +01:00
Daan De Meyer
53c3342253
Merge pull request #26948 from yuwata/vconsole-fix-memleak
vconsole: introduce Context and its helper functions
2023-03-24 11:28:00 +01:00
Daan De Meyer
0405e7c5e1
Merge pull request #26956 from yuwata/core-main-arguments-followed-by-equal
core/main: make arguments followed by '='
2023-03-24 11:27:45 +01:00
Yu Watanabe
4669be626d process-util: drop trailing NUls before parsing the nulstr
No functional changes, just refactoring.
2023-03-24 15:21:59 +09:00
Yu Watanabe
55479c208d test: add tests from strv_parse_nulstr_full() 2023-03-24 15:21:59 +09:00
Yu Watanabe
a4f66f90ad nulstr-util: introduce strv_parse_nulstr_full() that optionally drop trailing empty strings 2023-03-24 15:21:59 +09:00
Yu Watanabe
a3cb11f841 test-proc-cmdline: test proc_cmdline_get_key() actually parses EFI options
Follow-up for 53aa0d02ad.
2023-03-24 15:20:05 +09:00
Yu Watanabe
2a6911bb1f proc-cmdline: make proc_cmdline_parse_given() static
It is used only in proc-cmdline.c and its test. And the test can be
covered by proc_cmdline_parse().
2023-03-24 15:20:05 +09:00
Yu Watanabe
1479799c4d proc-cmdline: use proc_cmdline_key_string() when we search for key 2023-03-24 15:20:05 +09:00
Yu Watanabe
b3e9a267ce proc-cmdline: rename variable 2023-03-24 15:20:05 +09:00
Yu Watanabe
a175b98171 proc-cmdline: insert an empty line between variable declaration and assertion 2023-03-24 15:20:05 +09:00
Yu Watanabe
d2ebd50d7f core/main: make positional arguments followed by '=', then by value
To make ConditionKernelCommandLine= or friend not confused when we are
running in a container.

Addresses https://github.com/systemd/systemd/pull/26887#discussion_r1143358884.
2023-03-24 15:16:21 +09:00
Yu Watanabe
6920049fad core/main: fix maximum number of arguments for shutdown command
Follow-up for c5673ed0de.
2023-03-24 15:16:21 +09:00
Yu Watanabe
dfc55e3454 vconsole: introduce context_get_config() helper function
And make keyboard_load_and_wait() and font_load_and_wait() take Context.
2023-03-24 15:07:58 +09:00
Yu Watanabe
8886ca6286 vconsole: introduce Context and its helper functions
Fixes memleaks introduced by 01771226c2
and ea575e176a

Fixes #26945.
2023-03-24 15:07:58 +09:00
Daan De Meyer
ba54d73055 chase-symlinks: Use xopenat() instead of open_mkdir_at()
We don't rely on any of the extra functionality of open_mkdir_at()
so let's just use xopenat() directly.
2023-03-23 23:25:33 +00:00
Luca Boccassi
2a775d5faf
Merge pull request #26935 from keszybz/test-parse_aux
Add test for auxv parsing
2023-03-23 23:13:42 +00:00
Luca Boccassi
d024c4d0e1
Merge pull request #26949 from DaanDeMeyer/xopenat-reopen
loop-util: Add loop_device_make_by_path_at()
2023-03-23 23:08:21 +00:00
Lennart Poettering
b839101aac fileio: add new helper fdopen_independent()
This is a combination of fdopen() and fd_reopen(). i.e. it first reopens
the fd, and then converts that into a FILE*.

We do this at various places already manually. let's move this into a
helper call of its own.
2023-03-23 22:48:00 +00:00
Lennart Poettering
05bda20f07
Merge pull request #26953 from poettering/encrypted-cred-mini-refactor
core: minor refactoring of allowlisting TPM devices when encrypted creds are loaded
2023-03-23 21:21:45 +01:00
Lennart Poettering
df637af460 pid1: allowlist all tpm devices for a unit when encrypted creds are needed
We might be configured to use some ther device than /dev/tpmrm0, hence
allow them all by allowlisting the tpm char device class as a whole.
2023-03-23 18:22:43 +01:00
Lennart Poettering
50a4217bbe core: move encrypted credential check to execute.c
This is an operation on an ExecContext, hence it probably should be
placed there.
2023-03-23 18:22:27 +01:00
Zbigniew Jędrzejewski-Szmek
f39546a881 test-coredump-util: also test parse_auxv() with unaligned data 2023-03-23 18:07:45 +01:00
Zbigniew Jędrzejewski-Szmek
2f809d29e8 test-coredump-util: add tests for parse_aux()
The test files are /proc//auxv files copies from various architecutres
signified by the file name suffix.

Those tests are fairly simple, but when we run them on n architectures, we do
~n² cross-arch tests.
2023-03-23 18:06:46 +01:00
Zbigniew Jędrzejewski-Szmek
cb38fdbedb coredump: split out parse_auxv() to src/shared/
No functional change. (We already checked for ELFCLASS32 or ELFCLASS64 before,
so even though there's a new check for other architectures, the only caller
only passes ELFCLASS32 or ELFCLASS64.)
2023-03-23 18:04:22 +01:00
Daan De Meyer
972c8db589 loop-util: Add loop_device_make_by_path_at()
On top of taking a directory file descriptor, we use xopenat() so
that the function can also be used to work on existing file
descriptors to image files including all the logic to use O_DIRECT
and fallback to O_RDONLY if needed.
2023-03-23 17:36:17 +01:00
Daan De Meyer
06ca2db39d fs-util: Allow xopenat() to reopen existing file descriptors 2023-03-23 17:31:55 +01:00
Mike Yuan
f1710073c7
Merge pull request #26214 from YHNdnzj/sd-notify-change-notifyaccess
core: support overriding NOTIFYACCESS= through sd-notify during runtime
2023-03-24 00:11:29 +08:00
Daan De Meyer
1441a6a751 docs: Explicitly tell developers to enable mkosi required meson options
We need repart, bootctl, analyze and ukify for mkosi so let's make
sure those get built in the HACKING guide.
2023-03-23 13:09:09 +00:00
наб
ed89819f8f find-esp: don't silently error bootctl install if presumed XBOOTLDR part is stx_dev_major=0 but not btrfs
btrfs_get_block_device_fd() returns -ENOTTY if fstatfs().f_type !=
BTRFS_SUPER_MAGIC

btrfs_get_block_device_fd() is run by verify_fsroot_dir() by
verify_xbootldr() by find_xbootldr_and_warn() if
statx($presumed-XBOOTLDR).stx_dev_major == 0 ("maybe a btrfs device")

Every bootctl verb_install() runs find_xbootldr_and_warn(), by default
with /boot

If your /boot .stx_dev_major=0 but /not/ btrfs, bootctl install/update
quietly exits 1 with no note so as to what exactly failed (debug also
empty, and the strace isn't exactly clear since no syscall actually
failed)

This is the case on ZFS and the Debian filesystem layout: /boot/efi is
the ESP, and everything else under / is ZFS:
  $ sudo env SYSTEMD_LOG_LEVEL=debug bootctl update
  Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
  Found container virtualization none.
  File system "/boot" is not a FAT EFI System Partition (ESP) file system.
  Using EFI System Partition at /boot/efi.
  Checking whether /boot/efi/EFI/systemd/ contains any files…
  $ echo $?
  1
and funnier still:
  $ sudo bootctl update --graceful
  $ echo $?
  1

Which is great, and also breaks postinst, which runs precisely the
latter, with no feedback at all

By checking for -ENOTTY we accept that the path being investigated
"is not it" if it's on ZFS (and any other filesystem that returns
.stx_dev_major == 0 but isn't btrfs)
2023-03-23 13:35:25 +01:00
Zbigniew Jędrzejewski-Szmek
d175b709e4 test-fileio: add test for return value of read_one_line_file()
Prompted by https://github.com/systemd/systemd/pull/26904#pullrequestreview-1349890241.
2023-03-23 13:32:45 +01:00
Daan De Meyer
1d5240cfaa
Merge pull request #26936 from DaanDeMeyer/xopenat-lock
fs-util: Add xopenat_lock()
2023-03-23 07:49:12 +01:00
Daan De Meyer
a7253c7fec
Merge pull request #26916 from DaanDeMeyer/log-context-ref
log: Avoid pushing the same fields more than once on the log context
2023-03-22 22:07:45 +01:00
Daan De Meyer
2646b86dd6 fs-util: Add xopenat_lock()
open/create a file/directory and lock it using the given lock type.
2023-03-22 21:54:20 +01:00
Mike Yuan
da037170c4 edit-util: alloc correct amount of memory 2023-03-22 23:25:25 +08:00
Yu Watanabe
9b032f932c coredump: use unaligned_read_ne{32,64}() to parse auxv
Fixes a bug introduced by 3e4d0f6cf9.

The auxv metadata is unaligned, as the length of the prefix
"COREDUMP_PROC_AUXV=" is 19. Hence, parse_auxv{32,64}() may triger
an undefined behavior (or at least cause slow down), which can be
detected when running on an undefined behavior sanitizer.

This also introduces a macro to define `parse_auxv{32,64}()`.

Fixes #26912.
2023-03-22 16:17:13 +01:00
Tobias Powalowski
bf9f07a629
ukify: allow uncompressed kernel images for UNAME detection on aarch64 and riscv64 (#26929)
Uncompressed aarch64 and riscv64 kernels have a different startpoint than x86.
Example output from ukify:
aarch64: NotImplementedError: unknown file format (starts with b'MZ@\xfa')
riscv64: NotImplementedError: unknown file format (starts with b'MZo\x10')
Add check for (b'MZ') to catch both in one call.

Fix:
https://github.com/systemd/systemd/issues/26923
2023-03-22 12:24:57 +00:00
Daan De Meyer
a3b00f91bb core: Settle log target if we're going to be closing all fds
Whenever we're going to close all file descriptors, we tend to close
the log and set it into open when needed mode. When this is done with
the logging target set to LOG_TARGET_AUTO, we run into issues because
for every logging call, we'll check if stderr is connected to the
journal to determine where to send the logging message. This check
obviously stops working when we close stderr, so we settle the log
target before we do that so that we keep using the same logging
target even after stderr is closed.
2023-03-22 13:20:08 +01:00
David Tardon
8d0747abb7 labeler: add journal label also for sd-journal stuff 2023-03-22 13:18:55 +01:00
Mike Yuan
b64f5ddaca
test: add tests for NOTIFYACCESS override through sd_notify 2023-03-22 19:22:10 +08:00
Daan De Meyer
bd7a79528c stat-util: Add verify_regular_at() 2023-03-22 12:17:14 +01:00
Daan De Meyer
997bc9ec56
Merge pull request #26829 from DaanDeMeyer/copy-at
copy: Add more at() helpers
2023-03-22 09:53:51 +01:00
Kevin P. Fleming
06d104d58f bootctl: 'graceful' should ignore EFI variable failures
Suppress errors when creating/writing EFI variables during 'bootctl update' if
'--graceful' mode is active (as the documentation indicates).

Closes #26773.
2023-03-22 09:16:49 +01:00
Yu Watanabe
206760a4bc
Merge pull request #26928 from jamacku/update-shellcheck
ci: trigger `differential-shellcheck` workflow on push
2023-03-22 15:13:38 +09:00
Jan Macku
a33d7c4cc9 ci: limit permissions for differential-shellcheck 2023-03-22 06:56:34 +01:00
Jan Macku
50ba79710e ci: trigger differential-shellcheck workflow on push
Also update `differential-shellcheck` to latest version - https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases

Fixes: https://github.com/redhat-plumbers-in-action/differential-shellcheck/issues/215
2023-03-22 06:56:34 +01:00
Mike Yuan
19dff6914d
core: support overriding NOTIFYACCESS= through sd-notify during runtime
Closes #25963
2023-03-22 06:33:12 +08:00