Commit Graph
45714 Commits
Author SHA1 Message Date
Valentin David 7a876307bb stub: Ignore the boot counter when looking for .extra.d directory
If `foo+3-0.efi` is booted when there are some files in `foo.efi.extra.d`,
those files are ignored. But after the boot is blessed and the system rebooted,
those file are taken into account, and the boot is different from first
boot. This behavior is a bit puzzling.

Instead we now ignore the counter and always look for the extra files in
`foo.efi.extra.d` and always boot the same way.
2023-10-20 16:18:09 +01:00
Malte PollandPaul Meyer b2942c76ad mkfs-util: set timezone to UTC when copying files into fat partition
mcopy will set the modification time of created directories to the mtime
of the source directories but converts it to the timezone of the host.
This behavior is identical to Windows / DOS:

>  The FAT file system stores time values based on the local time of the computer.

-- https://learn.microsoft.com/en-us/windows/win32/sysinfo/file-times

To achieve reproducible builds, mcopy should be invoked with TZ=UTC.

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2023-10-20 16:15:52 +01:00
Lennart Poettering 83ee462c72 tpm2: move event tag sd-boot/sd-stub to make measurements with into src/fundamental/
Ultimately we want to be able to recognize these in userspace, hence
make them available in both UEFI mode and userspace.

While we are at it, let's rename the fields a bit, reflecting more what
they measure, not what the metadata is that we store about them.
2023-10-20 15:58:45 +01:00
Lennart Poettering 4c4de97db8 sort-utils: add generic uint16_t comparison call 2023-10-20 15:57:58 +01:00
Lennart Poettering 07f314575b format-table: add new table_get_current_column() helper 2023-10-20 15:57:25 +01:00
Lennart Poettering f4ae435bec format-table: add new uint32_t hex field type 2023-10-20 15:55:15 +01:00
Luca Boccassi 055ca3cd0a Merge pull request #29644 from poettering/json-iovec
add iovec/base64 json helpers and other iovec tweaks
2023-10-20 15:54:29 +01:00
Daan De Meyer 26204e1a4a Merge pull request #29630 from DaanDeMeyer/manager-json
Various refactoring in preparation for adding JSON dump to pid 1
2023-10-20 16:42:12 +02:00
Luca Boccassi f455365031 Merge pull request #29626 from bluca/auto_soft_reboot
systemctl: automatically softreboot/kexec if set up on reboot
2023-10-20 13:46:46 +01:00
Lennart Poettering 6b4b40f490 repart: port to new "struct iovec" JSON + primitive helpers 2023-10-20 14:38:16 +02:00
Lennart Poettering 0342772031 json: add helpers for dispatching/building JSON with base64 struct iovecs 2023-10-20 14:38:16 +02:00
Lennart Poettering 3a856171c2 iovec-util: add some useful helpers for dealing with iovecs that refer to dynamic memory 2023-10-20 14:38:16 +02:00
Lennart Poettering f7ad4376c5 tpm2-util: add line break where appropriate 2023-10-20 14:34:11 +02:00
Lennart Poettering 2216c27c7d tpm2-util: add a bunch of line breaks for an overly long bitmask 2023-10-20 14:33:55 +02:00
Daan De Meyer 8eb735b800 json: Introduce JSON_BUILD_CALLBACK 2023-10-20 14:09:32 +02:00
Daan De Meyer a636a058f1 json: Introduce JSON_BUILD_STRING_SET 2023-10-20 14:09:32 +02:00
Daan De Meyer b2e9d80956 hashmap: Add extra uncounted entry to returned array from hashmap_dump_sorted()
This allows using the returned array as a strv.
2023-10-20 14:09:32 +02:00
Daan De Meyer cc156539d9 manager: Introduce manager_get_progress() helper 2023-10-20 14:09:32 +02:00
Daan De Meyer f882c1029d unit: Move three helpers to unit.h 2023-10-20 14:09:32 +02:00
Daan De Meyer f8a990a0a1 timer: Add two more helper functions 2023-10-20 14:09:32 +02:00
Daan De Meyer f57cc32fa1 swap: Move two functions to swap.h 2023-10-20 14:09:32 +02:00
Daan De Meyer e49b211073 socket: Add one more helper 2023-10-20 14:09:32 +02:00
Daan De Meyer 8dbab37dec mount: Add more helpers 2023-10-20 14:09:30 +02:00
Daan De Meyer ef44aa831f execute: Add more helper functions 2023-10-20 14:03:25 +02:00
Daan De Meyer 435996e63f core: Add two more to_string() functions 2023-10-20 13:30:13 +02:00
Daan De Meyer 1b17dd9099 Add unit_type_to_capitalized_string() 2023-10-20 13:30:11 +02:00
Luca Boccassi beea591742 Merge pull request #29627 from poettering/io-split
split up io-util.[ch], and some clean-ups
2023-10-20 12:19:22 +01:00
Daan De Meyer 6bbb893b90 rm-rf: Make sure we rewinddir() before readdir()
We don't know what state the passed in file descriptor is in. Let's
make sure we rewind it before iterating over it.

Fixes #29606
2023-10-20 11:55:53 +01:00
Luca Boccassi 665a3d6d15 systemctl: automatically softreboot/kexec if set up on reboot
Automatically softreboot if the nextroot has been set up with an OS
tree, or automatically kexec if a kernel has been loaded with kexec
--load.

Add SYSTEMCTL_SKIP_AUTO_KEXEC and SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT to
skip the automated switchover.
2023-10-20 11:45:37 +01:00
Yu Watanabe af7417ac7b netif-naming-scheme: disable NAMING_BRIDGE_MULTIFUNCTION_SLOT
This effectively reverts 66425daf2c.

The commit assumes that if the network interface has multifunctions,
then the function fields of the pci devices under the same PCI bridge
device are unique.
But it seems not, at least on some setups. See issue #28929.
Let's revert the change, and always refuse to set slot base naming if
a PCI bridge is detected.

Fixes #28929.
2023-10-20 10:56:48 +01:00
Luca Boccassi ed51ccf4b8 Merge pull request #29618 from bonktree/fchmodat2
seccomp: get `fchmodat2(2)` covered by `RestrictSUIDSGID=`
2023-10-20 10:49:46 +01:00
Lennart Poettering ea1f38146a io-util: split out iovw_xyz into iovec-wrapper.h
Let's split these APIs out, they are kinda their own thing.
2023-10-20 10:43:50 +02:00
Lennart Poettering 986235a99a iovec-util: make IOVEC_INCREMENT a regular function too
Even more than with the previous commit, this is not a trivial function
and there's no reason to believe this will actually be inlined nor that
it would be beneficial.
2023-10-20 10:43:50 +02:00
Lennart Poettering 9599ea28b4 iovec-util: make IOVEC_MAKE_STRING() safer
Let's not accept arbitrary types, but only char* and const char*.
2023-10-20 10:43:50 +02:00
Lennart Poettering e2a3bb22c8 iovec-util: make IOVEC_NULL const
compound initialized structs can be placed im immutable memory if const,
hence there's benefit in making this one const too
2023-10-20 10:43:50 +02:00
Lennart Poettering c24e0dbea1 iovec-util: make IOVEC_TOTAL_SIZE() a regular function
The function isn't necessarily fast (it's O(n)), and there's no reason
to have it defined as inline function, since it's neither fast, nor
entirely trivial.
2023-10-20 10:43:50 +02:00
Lennart Poettering bd1ae17833 io-util: split out "struct iovec" related calls into their own .c/.h files
This is preparation for #28891, which adds a bunch more helpers around
"struct iovec", at which point this really deserves its own .c/.h file.

The idea is that we sooner or later can consider "struct iovec" as an
entirely generic mechanism to reference some binary blob, and is the
go-to type for this purpose whenever we need one.
2023-10-20 10:34:33 +02:00
Luca Boccassi 856bed0abe executor: return instead of assert on invalid command line arguments
Before the split, it made sense to assert, as checks were on setup.
But now these come from deserialization, and the fuzzer hits the
asserts, so simply return an error instead.
2023-10-20 01:00:36 +01:00
Zbigniew Jędrzejewski-Szmek 974959e6f6 test-recurse-dir: work around nftw() ignoring symlinks()
We have a test where we compare the results from nftw() and our own
resurce_dit_at(). nftw() skips a dangling symlink when running under mkosi and
the test fails. I don't understand why nftw() does that, but in our code we
don't need to test and care about the details of nftw(), which we don't use,
outside of the one test, so let's just skip symlinks in the test.

Closes #29603.
2023-10-19 22:40:22 +01:00
Luca Boccassi f5a7476677 Merge pull request #29628 from mrc0mmand/systemd-executor-test
test: slightly improve sd-executor's coverage
2023-10-19 19:39:39 +01:00
Lennart Poettering 9bb64f1b8d pidref: make PIDREF_NULL const
That way compiler can put it in an immutable section
2023-10-19 18:59:51 +01:00
Luca Boccassi 759cca0348 Merge pull request #29629 from bluca/mount_tunnel_pidref
mount tunnel: use PidRef
2023-10-19 18:59:22 +01:00
Luca Boccassi 6fbd1b0457 Merge pull request #29623 from YHNdnzj/core-followup
Follow-ups for recent changes to core/
2023-10-19 18:04:40 +01:00
Zbigniew Jędrzejewski-Szmek af189d7b50 pid1,vconsole-setup: lock /dev/console instead of the tty device
As requested in https://github.com/systemd/systemd/pull/27867#pullrequestreview-1567161854.
/dev/console, /dev/tty0, and /dev/ttyN are "different" device nodes
that may point to a single underlying device. We want to use a single
lock so that we don't get a race if different writers are using a different
device path, so let's just always lock around /dev/console.
This effectively makes the locking less granular.

Fixup for a0043bfa51.
Fixes https://github.com/systemd/systemd/issues/28721.
Maybe fixes https://github.com/systemd/systemd/issues/28778 and
https://github.com/systemd/systemd/issues/28634.
2023-10-19 18:03:21 +01:00
Luca Boccassi 5f48198af8 mount tunnel: use PidRef 2023-10-19 16:31:05 +01:00
Frantisek Sumsal d31330c1fa core: properly cleanup ExecParameter's prefix array 2023-10-19 16:59:43 +02:00
Mike Yuan bca0805311 core/service: check error first and log about errno
Follow-up for becdfcb9f1
2023-10-19 21:37:39 +08:00
Mike Yuan f65a40fb0b cgroup-util: use RET_GATHER more, return first error 2023-10-19 21:37:33 +08:00
Mike Yuan dbc0342e61 core/exec-invoke: use correct exit status
These calls can fail not only due to OOM.
2023-10-19 21:37:33 +08:00
Mike Yuan bbe92ea5cc core/namespace: merge if blocks 2023-10-19 21:37:33 +08:00