summaryrefslogtreecommitdiffstats
path: root/src/basic/efivars.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-03-24process-util: drop trailing NUls before parsing the nulstrYu Watanabe1-9/+3
No functional changes, just refactoring.
2023-03-24test: add tests from strv_parse_nulstr_full()Yu Watanabe1-68/+47
2023-03-24nulstr-util: introduce strv_parse_nulstr_full() that optionally drop ↵Yu Watanabe2-2/+9
trailing empty strings
2023-03-24test-proc-cmdline: test proc_cmdline_get_key() actually parses EFI optionsYu Watanabe1-5/+10
Follow-up for 53aa0d02add93d8c0afa2772609372a2040c162a.
2023-03-24proc-cmdline: make proc_cmdline_parse_given() staticYu Watanabe3-7/+6
It is used only in proc-cmdline.c and its test. And the test can be covered by proc_cmdline_parse().
2023-03-24proc-cmdline: use proc_cmdline_key_string() when we search for keyYu Watanabe2-5/+9
2023-03-24proc-cmdline: rename variableYu Watanabe1-3/+3
2023-03-24proc-cmdline: insert an empty line between variable declaration and assertionYu Watanabe1-0/+1
2023-03-24core/main: make positional arguments followed by '=', then by valueYu Watanabe1-18/+15
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-24core/main: fix maximum number of arguments for shutdown commandYu Watanabe1-1/+1
Follow-up for c5673ed0de3bec38f68d8113d253842b47766e27.
2023-03-24vconsole: introduce context_get_config() helper functionYu Watanabe1-14/+34
And make keyboard_load_and_wait() and font_load_and_wait() take Context.
2023-03-24vconsole: introduce Context and its helper functionsYu Watanabe1-41/+149
Fixes memleaks introduced by 01771226c202183ff447da712f43d2fad8874484 and ea575e176aac9fa8f430bb30a3e8abd8da767a10 Fixes #26945.
2023-03-24chase-symlinks: Use xopenat() instead of open_mkdir_at()Daan De Meyer1-1/+1
We don't rely on any of the extra functionality of open_mkdir_at() so let's just use xopenat() directly.
2023-03-23fileio: add new helper fdopen_independent()Lennart Poettering6-26/+82
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-23pid1: allowlist all tpm devices for a unit when encrypted creds are neededLennart Poettering1-1/+1
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-23core: move encrypted credential check to execute.cLennart Poettering3-11/+19
This is an operation on an ExecContext, hence it probably should be placed there.
2023-03-23test-coredump-util: also test parse_auxv() with unaligned dataZbigniew Jędrzejewski-Szmek1-10/+39
2023-03-23test-coredump-util: add tests for parse_aux()Zbigniew Jędrzejewski-Szmek14-57/+92
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-23coredump: split out parse_auxv() to src/shared/Zbigniew Jędrzejewski-Szmek3-69/+107
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-23loop-util: Add loop_device_make_by_path_at()Daan De Meyer2-7/+24
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-23fs-util: Allow xopenat() to reopen existing file descriptorsDaan De Meyer2-1/+11
2023-03-23docs: Explicitly tell developers to enable mkosi required meson optionsDaan De Meyer1-1/+1
We need repart, bootctl, analyze and ukify for mkosi so let's make sure those get built in the HACKING guide.
2023-03-23find-esp: don't silently error bootctl install if presumed XBOOTLDR part is ↵наб1-1/+1
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-23test-fileio: add test for return value of read_one_line_file()Zbigniew Jędrzejewski-Szmek1-0/+36
Prompted by https://github.com/systemd/systemd/pull/26904#pullrequestreview-1349890241.
2023-03-22fs-util: Add xopenat_lock()Daan De Meyer5-24/+125
open/create a file/directory and lock it using the given lock type.
2023-03-22edit-util: alloc correct amount of memoryMike Yuan1-1/+1
2023-03-22coredump: use unaligned_read_ne{32,64}() to parse auxvYu Watanabe1-89/+60
Fixes a bug introduced by 3e4d0f6cf99f8677edd6a237382a65bfe758de03. 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-22ukify: allow uncompressed kernel images for UNAME detection on aarch64 and ↵Tobias Powalowski1-0/+4
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-22core: Settle log target if we're going to be closing all fdsDaan De Meyer7-0/+24
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-22labeler: add journal label also for sd-journal stuffDavid Tardon1-0/+1
2023-03-22test: add tests for NOTIFYACCESS override through sd_notifyMike Yuan7-0/+85
2023-03-22stat-util: Add verify_regular_at()Daan De Meyer2-0/+13
2023-03-22bootctl: 'graceful' should ignore EFI variable failuresKevin P. Fleming1-9/+22
Suppress errors when creating/writing EFI variables during 'bootctl update' if '--graceful' mode is active (as the documentation indicates). Closes #26773.
2023-03-22ci: limit permissions for `differential-shellcheck`Jan Macku1-1/+0
2023-03-22ci: trigger differential-shellcheck workflow on pushJan Macku1-1/+4
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-21core: support overriding NOTIFYACCESS= through sd-notify during runtimeMike Yuan6-12/+80
Closes #25963
2023-03-21copy: Add more at() helpersDaan De Meyer2-12/+28
2023-03-21copy: Move chattr arguments to full function signaturesDaan De Meyer15-32/+35
These are almost never used, so let's move them to the _full() functions signatures.
2023-03-21fd-util: make sure fd_reopen() works with AT_FDCWD systematicallyLennart Poettering1-3/+9
Prompted by: https://github.com/systemd/systemd/pull/26827#pullrequestreview-1341171981
2023-03-21execute: Add kernel cmdline arguments for tty term, rows and columnsDaan De Meyer2-5/+110
Let's allow configuring tty term and size using kernel cmdline arguments so that when running in a VM we can communicate the terminal TERM and size from the host via SMBIOS extra kernel cmdline arguments.
2023-03-21docs: Fix vscode debugging section in HACKING.mdDaan De Meyer1-12/+13
Let's account for the recent changes in mkosi in the debugging with vscode section.
2023-03-21chase-symlinks: Add more chase_symlinks_at() helpersDaan De Meyer3-0/+223
Copies of the corresponding chase_symlinks() helpers.
2023-03-21chase-symlinks: Return zero from access() and stat() helpersDaan De Meyer1-16/+8
We never check if r > 0 when using these helpers, so let's just return zero like we usually do.
2023-03-21chase-symlinks: Add CHASE_EXTRACT_FILENAME flagDaan De Meyer3-9/+52
Useful in combination with CHASE_PARENT to get a directory file descriptor to the parent directory of the resolved path and the filename of the resolved path in the parent directory (which might not be the same as the filename of the input path because of symlinks).
2023-03-21udev-rules: fix nvme symlink creation on namespace changesThomas Blume2-0/+10
The nvme by-id symlink changes to the latest namespace when a new namespace gets added, for example by connecting multiple NVMe/TCP host controllers via nvme connect-all. That is incorrect for persistent device links. The persistent symbolic device link should continue to point to the same NVMe namespace throughout the lifetime of the current boot. Therefore the namespace id needs to be added to the link name.
2023-03-21tmpfile-util: Add open_tmpfile_linkable_at() and link_tmpfile_at()Daan De Meyer2-12/+20
2023-03-21fs-util: Add open_parent_at()Daan De Meyer2-4/+18
2023-03-21lock-util: Add make_lock_file_at()Daan De Meyer4-6/+60
2023-03-21unit: Add LOG_CONTEXT_PUSH_UNIT()Daan De Meyer2-0/+12
A helper macro to push all unit related fields onto the log context. We also modify exec_spawn() to use it.
2023-03-21log: Add key/value support to the log contextDaan De Meyer5-20/+75
Now that we have reference counting, it's useful to be able to push single key values onto the log context separately, so that we don't have to allocate new storage to join the separate string together into a single field which means we won't be able to reuse a context containing the same field.