Commit Graph
63059 Commits
Author SHA1 Message Date
Yu Watanabe dcbe37ca2f Merge pull request #26752 from Foxboron/morten/fix-manpage
src: Fixup copy-paste error for terminal_urlify_man
2023-03-11 17:12:47 +09:00
Morten Linderud 9e60dc0daf man: Fix pcrphase.service manvolnum from 1 to 8 2023-03-10 20:29:56 +01:00
Morten Linderud 6dadf31d61 src: Fixup copy-paste error for terminal_urlify_man
Signed-off-by: Morten Linderud <morten@linderud.pw>
2023-03-10 20:21:30 +01:00
Yu Watanabe c3600c380a generator: fix comment 2023-03-11 03:32:23 +09:00
Will Fancher 6e017b19a8 mount: Include After=local-fs-pre.target by default in initrd
Although it may be true that /sysroot and its children don't belong in
local-fs.target, that doesn't mean they shouldn't come after
local-fs-pre.target. For instance, systemd-hibernate-resume@.service needs to
come before /sysroot and its children, but currently that only happens
coincidentally because of the ordering between systemd-fsck@.service and
local-fs-pre.target. As a result, mount units can be mistakenly started
simultaneously with systemd-hibernate-resume@.service, which can cause
corruption and data loss in the worst of cases.
2023-03-11 02:10:41 +09:00
Daan De Meyer aa41079175 Merge pull request #26726 from DaanDeMeyer/cleanups
Various small cleanups
2023-03-10 14:22:53 +01:00
Lennart Poettering d0ed83f3ae Merge pull request #26737 from poettering/runtime-scope
add RuntimeScope enum, replacing LookupScope and various booleans indicating whether we are called in a per-system or per-user context
2023-03-10 13:09:40 +01:00
Lennart Poettering 8c327f7e98 Merge pull request #26747 from poettering/dissect-common-decrypt
minor clean-ups for src/dissect/dissect.c
2023-03-10 13:07:22 +01:00
Luca Boccassi 5c67a8a188 test: run script from /tmp, not /run
On Debian the test fails because /run is noexec. Simply create the
script in /tmp (and use a BindPath=), as other tests are doing.

Follow-up for 3b7101183c
2023-03-10 11:01:22 +00:00
Daan De Meyer 37c485482f lock-util: Use unposix_lock() in make_lock_file() and release_lock_file() 2023-03-10 11:57:43 +01:00
Daan De Meyer 460accdf3d user-util: Use unposix_lock() in take_etc_passwd_lock() 2023-03-10 11:57:43 +01:00
Daan De Meyer 4dd888dc92 lock-util: Move to src/basic 2023-03-10 11:57:43 +01:00
Daan De Meyer b4cbfa5f1b lock-util: Add CLEANUP_UNPOSIX_UNLOCK()
Also migrate the logic in dynamic-user.c to use the new cleanup
macro.
2023-03-10 11:57:43 +01:00
Daan De Meyer 663fd3e103 lock-util: Add unposix_lock()
Let's add an interface to UNPOSIX locks that mimicks the flock()
interface for BSD locks.
2023-03-10 11:57:40 +01:00
Lennart Poettering b7df862213 dissect: use a switch statements where appropriate 2023-03-10 11:36:34 +01:00
Lennart Poettering 94abea2abf dissect: share dissected_image_decrypt_interactively() invocation between actions
Let's invoke dissected_image_decrypt_interactively() at once place only,
instead of in each function separately.

No actual changes, just some minor refactoring.
2023-03-10 11:36:34 +01:00
Lennart Poettering f69edd6faf Merge pull request #26331 from ddstreet/tpm2_pcr_read
Tpm2 pcr read
2023-03-10 10:24:39 +01:00
Daan De Meyer 64e89f56a9 lockfile-util: Rename to lock-util 2023-03-10 10:14:43 +01:00
Daan De Meyer ed70a34ec0 lockfile-util: Drop flock() fallback
UNPOSIX locks were added in 3.15 which is now our minimal kernel
version, so let's drop the fallback.
2023-03-10 10:14:41 +01:00
Lennart Poettering 40d73340fa runtime-scope: add helper that turns RuntimeScope enum into --system/--user string 2023-03-10 09:47:58 +01:00
Lennart Poettering 4870133bfa basic: add RuntimeScope enum
In various tools and services we have a per-system and per-user concept.
So far we sometimes used a boolean indicating whether we are in system
mode, or a reversed boolean indicating whether we are in user mode, or
the LookupScope enum used by the lookup path logic.

Let's address that, in introduce a common enum for this, we can use all
across the board.

This is mostly just search/replace, no actual code changes.
2023-03-10 09:47:39 +01:00
Lennart Poettering 5f64d2bf33 socket-util: fix socket_get_family()
Function didn't actually return anything useful. Quite a shame.
2023-03-10 09:36:18 +01:00
Lennart Poettering 862481ece0 Merge pull request #26693 from poettering/udev-loop-links
udev: add /dev/loop/by-inode/… + /dev/loop/by-ref/… loopback block device symlinks
2023-03-10 09:34:31 +01:00
Lennart Poettering 96c96fb250 Merge pull request #26704 from poettering/mnt-nosymlinks
Set MS_NOSYMFOLLOW for ESP + XBOOTLDR and many mount option clean-ups
2023-03-10 09:34:04 +01:00
Daan De Meyer 4b8ce14f6c repart: Add support for reading mkfs options from environment 2023-03-10 09:33:39 +01:00
Lennart Poettering e0e818bb14 Merge pull request #26741 from poettering/acquire-fd-fixes
trivial fixes to acquire_data_fd()
2023-03-10 09:33:20 +01:00
Ronan Pigott 0b40688d18 load-fragment: add user credential specifiers to user.conf
This enables the ManagerEnvironment= settings in the user's user.conf to
reference some user data like $HOME for the purpose of setting
environment variables derived from these values.
2023-03-10 00:05:37 +00:00
Luca Boccassi 28f3cbbded Merge pull request #26734 from mrc0mmand/test-followups
Assorted test tweaks
2023-03-10 00:03:48 +00:00
Luca Boccassi d56391b40f Merge pull request #26731 from yuwata/mempressure-follow-ups
Mempressure follow ups
2023-03-09 22:35:29 +00:00
Lennart Poettering 274a3b0075 data-fd-util: use fd_reopen() a bit more 2023-03-09 22:56:53 +01:00
Lennart Poettering 92c6f73cc5 fd-util: move ACQUIRE_NO_XYZ flags to the header the function using them is in
Follow-up for: b25a930f0e
2023-03-09 22:56:30 +01:00
Lennart Poettering a617007417 mempress: change default PSI window duration to 2s
This changes the PSI window duration we default to for watching memory
pressure events from 1s to 2s. This is because apparently the kernel
will soon disallow window durations other than 2s for unprivileged
processes.

Hence, we'll bump the threshold from 100m to 200ms, and the window from
1s to 2s.
2023-03-09 22:31:20 +01:00
Lennart Poettering aa03f49917 update TODO 2023-03-09 22:29:11 +01:00
Lennart Poettering f5e46b9e09 test: test new systemd-dissect --attach/--detach/--loop-ref= and /dev/loop/* symlinks
Let's test that everything we just added works in combination.
2023-03-09 22:29:11 +01:00
Lennart Poettering e1349c045e mountpoint-util: add comment explaining why fstype_can_discard() can't use mount_option_supported() 2023-03-09 21:56:42 +01:00
Lennart Poettering 6eda6f7e51 mountpoint-util: add new fstype_can_umask() helper 2023-03-09 21:56:42 +01:00
Lennart Poettering 034ebc47a2 mountpoint-util: move 'norecovery' detection into its own helper call
And let's also ask the kernel explicitly for support.
2023-03-09 21:56:42 +01:00
Lennart Poettering 4e6d305ae2 mountpoint-util: use mount_option_supported() to detect if 'discard' is support for an fs 2023-03-09 21:56:42 +01:00
Lennart Poettering 117e703447 mountpoint-util: generalize mount_option_supported() 2023-03-09 21:56:42 +01:00
Lennart Poettering de1461ac5e gpt-auto-generator: port to partition_pick_mount_options() too
This way we'll have the same mount options in place if we boot via the
gpt generator, or if we mount a DDI locally.

Note that this will also enable MS_NOSYMFOLLOW on ESP and XBOOTLDR now,
if booted via gpt-auto-generator.
2023-03-09 21:56:42 +01:00
Lennart Poettering 254e392e73 dissect-image: set MS_NOSYMFOLLOW for ESP/XBOOTLDR
When we mount a DDI, let's set MS_NOSYMFOLLOW for ESP/XBOOTLDR. They are
generally untrusted territory, (i.e. outside of
encryption/authentication via dm-crypt/dm-verity). Moreover they are
generally FAT, where symlinks don't exist anyway. Let's hence disable
symlinks for them.

This slightly refactors how we put together mount options for mounts,
splitting this out into a new helper call
dissected_partition_pick_options(), which we should be able to reuse
later in gpt-auto-generator, to ensure mounts via loopback as DDI and
those on bare metal get the same options.
2023-03-09 21:56:42 +01:00
Dan Streetman c57d8bc871 tpm2: add tpm2_pcr_read() 2023-03-09 10:46:19 -05:00
Dan Streetman e067a49fd1 test/test-tpm2: add tests for pcr selection functions 2023-03-09 10:46:19 -05:00
Dan Streetman c69bd0abdb tpm2: add/rename functions to manage pcr selections
This renames some functions to match other to/from_string() naming,
and allows better management of TPML_PCR_SELECTION and TPMS_PCR_SELECTION
structs.
2023-03-09 10:46:19 -05:00
Dan Streetman aa07a4fa35 tpm2: add TPM2_PCR_VALID() 2023-03-09 10:46:19 -05:00
Dan Streetman 23b972d571 tpm2: add tpm2_get_policy_digest() 2023-03-09 10:46:19 -05:00
Dan Streetman 5e31ddd11e test/test-bitfield: add tests for bitfield macros 2023-03-09 10:46:12 -05:00
Lennart Poettering 5ac52d1f7b udev: add /dev/loop/ symlinks
This adds symlinks that allow accessing loopback block devices via stable
names that reference their backing block devices, make the unpredictable
naming of loopback devices less of an issue.

Example:

1. Create a loopback block device for a file $F

   losetup --find $F

2. Reference the backing block device via its inode:

   L="$(stat -c '/dev/loop/by-inode/%Hd:%Ld-%i' $F)"
   fdisk $L

In the above the loop device name (which might be /dev/loop47 or any
other name) is not used at all.
2023-03-09 16:41:26 +01:00
Lennart Poettering 6f5ef9e4c7 dissect: shorten code a bit 2023-03-09 16:41:26 +01:00
Lennart Poettering 236d1fa210 dissect: allow setting "lo_file_name" field of loopback block devices
When attaching a loopback file this allows us to set an explicit name
for it. This is useful since it allows a caller to pre-select a string
that is directly attached to the loopback file. Via udev rules we'l
later make the device accessible through this name.

Note that "lo_file_name" is supposed to carry a file name of the backing
file, but the kernel actually does not care or enforce any of that, it
just stores the filename and returns it later. This makes it so useful,
as userspace has total control of that field.

"lo_file_name" should not be confused with the sysattr
"loop/backing_file" which is actually maintained by the kernel itself,
and always shows the file to the backing inode without userspace having
direct control over the returned string. Because the sysattr is
generated by the kernel it is subject to file system namespacing and
everything, while "lo_file_name" is not, it's really just a string
passed through the kernel.
2023-03-09 16:41:23 +01:00