Commit graph

68141 commits

Author SHA1 Message Date
Lennart Poettering 24aeaf4e7f glyph-util: add 'full block' glyph 2023-10-23 11:24:35 +01:00
Lennart Poettering 4cdef9f08c pcrextend: split out word to measure code into shared helper file
Let's split out the logic that actually generates the word to measure to
PCRs into a new helper file pcrextend-util.[ch].

This we can later reuse to calculate PCR measurement predictions ahead
of time.
2023-10-23 11:24:18 +01:00
Lennart Poettering 10cb55eef1 efi-api: export UUID converter calls
(while exporting, do some minor simplifications)
2023-10-23 11:23:56 +01:00
Julien Malka f64b9a1897 creds-utils: fix read_full_file_full call in read_credential_with_decryption
data was passed as a null pointer when an address was expected.
As a result, the assert was always tripped.
2023-10-23 09:36:04 +02:00
NAHO e6e5a272ed docs: correct parenthesis placement in 'man/tmpfiles.d.xml'
Correct the parenthesis placement in 'man/tmpfiles.d.xml' to prevent the
following formatting:

> lock ( shared or exclusive) is
2023-10-22 18:12:58 +01:00
Lennart Poettering b98c4f1d48 tpm2-util: rename tpm2_calculate_name() → tpm2_calculate_pubkey_name()
We'll soon have a function for determining the name of an NV index,
hence let's rename the existing function for the same of a public key to
make clear it's about public keys only.
2023-10-21 19:34:55 +01:00
Luca Boccassi 242b4bebcd
Merge pull request #29382 from YHNdnzj/sleep-round-two
shared/sleep-config,hibernate-util: cleanup round two
2023-10-21 11:51:09 +01:00
Martin Wilck bf25cf6c49 units: modprobe@.service: don't unescape instance name
modprobe treats "-" and "_" interchangeably, thereby avoiding frequent
errors because some module names contain dashes and others underscores.

Because modprobe@.service unescapes the instance name, an attempt to
start "modprobe@dm-crypt.service" will run "modprobe -abq dm/crypt",
which is doomed to fail. "modprobe@dm_crypt.service" will work as
expected. Thus unescaping the instance name has surprising side effects.
Use "%i" instead.
2023-10-21 11:41:22 +01:00
Franck Bui a1af99df8e test: install af_packet kernel module on openSUSE
Currently needed by test-dhcp-server unit test, af_packet is not built-in on
openSUSE distributions.
2023-10-21 11:39:10 +01:00
Luca Boccassi ed5c97029c
Merge pull request #29652 from yuwata/dhcp-cleanup-headers
dhcp: cleanup headers
2023-10-21 11:38:23 +01:00
Luca Boccassi 04144b9169
Merge pull request #29650 from YHNdnzj/more-followup
Some more follow-ups for recent PRs
2023-10-21 11:37:38 +01:00
Mike Yuan 0f095d0b8f
shared/mount-util: log correct errno
Follow-up for 5f48198af8
2023-10-21 06:25:36 +08:00
Mike Yuan 5d4072d0ed
man,docs: suffix directories with / 2023-10-21 06:25:35 +08:00
Mike Yuan fc932ed48f
core/execute: use FOREACH_ARRAY and free_many more 2023-10-21 06:25:35 +08:00
Yu Watanabe 8664ded716 dhcp: split dhcp-internal.h into two 2023-10-21 01:54:08 +09:00
Yu Watanabe 40e4be7e8e dhcp: move DHCP client specific definitions to dhcp-client-internal.h 2023-10-21 01:54:08 +09:00
Yu Watanabe 9bcbb61458 dhcp: split out dhcp-network.h from dhcp-internal.h 2023-10-21 01:54:07 +09:00
Yu Watanabe 8320db407c dhcp: move DHCPState to dhcp-client-internal.h
All other definitions in dhcp-protocol.h are common for client and
server. Let's move DHCP client specific definitions.
2023-10-21 01:54:07 +09:00
Yu Watanabe f3d84e20c9 fuzz: include library headers first 2023-10-21 01:54:07 +09:00
Mike Yuan 805deec039
hibernate-util: introduce hibernation_is_safe
After 7470b80763, we refuse
to hibernate if we fail to write HibernateLocation EFI
variable and resume= is not set. Let's teach sleep_supported
to follow the practice too.
2023-10-20 23:22:54 +08:00
Mike Yuan 596873c10c
hibernate-util: rework find_hibernate_location
* "HibernateLocation" struct is renamed to HibernationDevice
  to avoid ambiguity with the EFI variable. Also, it no longer
  takes the reference to a SwapEntry object, since it's really
  unnecessary (only SwapEntry.path is used), but increases complexity.
* SwapEntry is no longer used externally.
* find_hibernate_location is split into read_swap_entries and
  find_suitable_hibernation_device. The former reads all swap entries
  into SwapEntries object for later use.
* Make use of btrfs_get_file_physical_offset_fd

Closes #25130
2023-10-20 23:22:54 +08:00
Mike Yuan 2abc3c6d48
hibernate-util: read_fiemap: add missing asserts 2023-10-20 23:22:28 +08:00
Mike Yuan a0f6d74ec8
sleep-config: introduce sleep_supported_full that returns a reason
Preparation for later commits.

Also some other cleanups:
* Add assertions
* Use FOREACH_ARRAY
2023-10-20 23:22:28 +08:00
Mike Yuan 23577f4462
sleep-config: minor cleanup for can_sleep_{state,disk}
* Rename to sleep_{state,mode}_supported
* Treat unreadable/unwriable sysfs files as error
2023-10-20 23:22:28 +08:00
Mike Yuan d12babb574
test-btrfs-physical-offset: log correct errno 2023-10-20 23:22:28 +08:00
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 Poll 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