1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

63331 Commits

Author SHA1 Message Date
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
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
Daan De Meyer
427d9c34e6 copy: Add more at() helpers 2023-03-21 20:53:09 +01:00
Daan De Meyer
7c2f5495e2 copy: Move chattr arguments to full function signatures
These are almost never used, so let's move them to the _full()
functions signatures.
2023-03-21 20:53:09 +01:00
Daan De Meyer
f3e03bd04e
Merge pull request #26828 from DaanDeMeyer/tmpfile-at
tmpfile-util: Add open_tmpfile_linkable_at() and link_tmpfile_at()
2023-03-21 20:52:17 +01:00
Lennart Poettering
42db4a8db7 fd-util: make sure fd_reopen() works with AT_FDCWD systematically
Prompted by:

https://github.com/systemd/systemd/pull/26827#pullrequestreview-1341171981
2023-03-21 20:51:55 +01:00
Daan De Meyer
1c2e550ec4
Merge pull request #26866 from DaanDeMeyer/chase-fix
chase-symlinks: Add CHASE_FILENAME and more at() helpers
2023-03-21 20:50:48 +01:00
Daan De Meyer
4d62ee559d execute: Add kernel cmdline arguments for tty term, rows and columns
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-21 20:50:17 +01:00
Daan De Meyer
c84d14c525 docs: Fix vscode debugging section in HACKING.md
Let's account for the recent changes in mkosi in the debugging
with vscode section.
2023-03-21 17:47:51 +00:00
Daan De Meyer
12ef261794 chase-symlinks: Add more chase_symlinks_at() helpers
Copies of the corresponding chase_symlinks() helpers.
2023-03-21 16:08:35 +01:00
Daan De Meyer
88f2ee8601 chase-symlinks: Return zero from access() and stat() helpers
We never check if r > 0 when using these helpers, so let's just
return zero like we usually do.
2023-03-21 16:08:35 +01:00
Daan De Meyer
63bfd52f48 chase-symlinks: Add CHASE_EXTRACT_FILENAME flag
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-21 16:08:29 +01:00
Thomas Blume
c5ba7a2a4d udev-rules: fix nvme symlink creation on namespace changes
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-21 15:46:45 +01:00
Daan De Meyer
d294857ea6 tmpfile-util: Add open_tmpfile_linkable_at() and link_tmpfile_at() 2023-03-21 15:20:01 +01:00
Daan De Meyer
14460a8a2b fs-util: Add open_parent_at() 2023-03-21 15:20:01 +01:00
Daan De Meyer
aea3ca3613 lock-util: Add make_lock_file_at() 2023-03-21 15:19:33 +01:00
Daan De Meyer
4b2af439eb unit: Add LOG_CONTEXT_PUSH_UNIT()
A helper macro to push all unit related fields onto the log context.
We also modify exec_spawn() to use it.
2023-03-21 14:59:16 +01:00
Daan De Meyer
81b3565efd log: Add key/value support to the log context
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.
2023-03-21 14:54:04 +01:00
Daan De Meyer
883354532c log: Avoid pushing the same fields more than once on the log context
Let's try to optimize against pushing the same fields multiple times
onto the log context. To achieve this we make the log context reference
counted and return an existing context object if it's using the same
fields.

A consequence of this is that we have to make sure attaching/detaching
is coupled to the lifetime of the context object, so we make the attach
and detach functions private for now. If we need independent attach/detach
in the future, we can make that work with some extra complexity but since
we don't need it yet, let's not support it for now.
2023-03-21 14:25:10 +01:00
Yu Watanabe
2415a0c7aa
Merge pull request #26893 from yuwata/uki-util-update-log
util: rename uki-util.[ch] -> kernel-image.[ch]
2023-03-21 19:06:18 +09:00
Daan De Meyer
26f51ae430 mkosi: Default to debug log level for udev as well
Unlike CI, the debug output just goes to the journal, so there's no
harm in enabling it, even if it's noisy.
2023-03-21 11:01:34 +01:00
Antonio Alvarez Feijoo
9baeb58fcd man/network-generator: replace dracut.kernel reference with dracut.cmdline
`dracut.kernel.7` is just a symlink to `dracut.cmdline.7`, so the web reference
points to a non-existent URL
(https://man7.org/linux/man-pages/man7/dracut.kernel.7.html).
2023-03-21 19:00:00 +09:00
Antonio Alvarez Feijoo
dd23292c08 gpt-auto-generator: fix typo 2023-03-21 18:57:59 +09:00
Zbigniew Jędrzejewski-Szmek
cd36f4d79f
Merge pull request #26867 from dtardon/list-dependencies-circular
Fix printing of circular dependencies
2023-03-21 09:40:46 +01:00
Yu Watanabe
5689e161cf util: rename uki-util.[ch] -> kernel-image.[ch]
As the file contains functions not only for UKI.
2023-03-21 16:49:26 +09:00
Yu Watanabe
fe3198df66 uki-util: rename KernelType -> KernelImageType
The name KernelType is slightly ambiguous. The type is about kernel
image. Let's rename the enum to clarify that.
2023-03-21 16:44:52 +09:00
Yu Watanabe
fc56666cc2 uki-util: rename uki -> f
As the function is not only for UKI.
2023-03-21 16:40:39 +09:00
Yu Watanabe
b3e26aa2d9 uki-util: update log messages 2023-03-21 16:38:40 +09:00
Dmitry V. Levin
f0a16c9ae8 udev-rules: add another check for conflicting expressions
Log an error when a rule line contains the following kind of conflicting
match expressions:

  KEY=="foo", KEY=="bar"
2023-03-21 09:34:50 +09:00
OMOJOLA JOSHUA DAMILOLA
92035969e0 compare-operator: added unit tests 2023-03-20 17:54:02 +00:00