]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
20 months agotpm2-util: pick up Esys_PCR_Extend() symbol too
Lennart Poettering [Fri, 16 Sep 2022 21:15:41 +0000 (23:15 +0200)] 
tpm2-util: pick up Esys_PCR_Extend() symbol too

20 months agoMerge pull request #24781 from DaanDeMeyer/link-remove-check
Zbigniew Jędrzejewski-Szmek [Thu, 22 Sep 2022 13:38:16 +0000 (15:38 +0200)] 
Merge pull request #24781 from DaanDeMeyer/link-remove-check

systemctl: Remove check that linked unit files must contain a "/"

20 months agosystemctl: Fix style nit 24781/head
Daan De Meyer [Thu, 22 Sep 2022 12:42:00 +0000 (14:42 +0200)] 
systemctl: Fix style nit

20 months agoMerge pull request #24768 from keszybz/table-not-available-2
Lennart Poettering [Thu, 22 Sep 2022 12:17:40 +0000 (14:17 +0200)] 
Merge pull request #24768 from keszybz/table-not-available-2

Adjust table n/a text in more places

20 months agoMerge pull request #24620 from poettering/measure-tweaks
Luca Boccassi [Thu, 22 Sep 2022 11:53:48 +0000 (12:53 +0100)] 
Merge pull request #24620 from poettering/measure-tweaks

measure: some tweaks

20 months agoREADME: drop the LGTM badge
Frantisek Sumsal [Thu, 22 Sep 2022 11:47:49 +0000 (13:47 +0200)] 
README: drop the LGTM badge

20 months agosystemctl: Improve link directory separator error message
Daan De Meyer [Wed, 21 Sep 2022 18:42:06 +0000 (20:42 +0200)] 
systemctl: Improve link directory separator error message

Let's suggest users try ./<filename> when they encounter this error.

20 months agoshared/format-table: use empty_string instead of hardcoding "-" for invalid values 24768/head
Zbigniew Jędrzejewski-Szmek [Tue, 20 Sep 2022 18:39:16 +0000 (20:39 +0200)] 
shared/format-table: use empty_string instead of hardcoding "-" for invalid values

As requested in https://github.com/systemd/systemd/pull/24708#discussion_r973607866.

20 months agoshared/format-table: use enum instead of Table.empty_string
Zbigniew Jędrzejewski-Szmek [Tue, 20 Sep 2022 18:38:27 +0000 (20:38 +0200)] 
shared/format-table: use enum instead of Table.empty_string

All users were setting this to some static string (usually "-"), so let's
simplify things by not doing strdup, but instead limiting callers to a fixed
set of values. In preparation for the next commit, the function is renamed from
"empty" to "replacement", because it'll be used for more than empty fields. I
didn't do the whole string-table setup, because it's all used internally in one
file and this way we can immediately assert if an invalid value is passed in.

Some callers were (void)ing the error, others were ignoring it, and others
propagating. It's nicer to remove the boilerplate.

20 months agosystemd-run: refuse --working-directory option with --scope
Joost Heitbrink [Wed, 21 Sep 2022 18:11:44 +0000 (20:11 +0200)] 
systemd-run: refuse --working-directory option with --scope

systemd-run's man page says the following about the working directory of
the process:

"If a command is run as transient scope unit, it will be executed
by systemd-run itself as parent process and will thus inherit the
execution environment of the caller."

This means working directory assignment does not work, as evidenced by
the following invocation:
```bash
$ systemd-run --scope --property=WorkingDirectory=/tmp/ bash -c 'echo $(pwd)'
Unknown assignment: WorkingDirectory=/tmp/
```

However, using the shorthand switch --working-directory silently ignores
this instead of giving a similar error.
```bash
systemd-run --scope --user --working-directory=/tmp/ bash -c 'echo $(pwd)'
Running scope as unit: run-r19cc32e744e64285814dbf2204637a2b.scope
/home/test/projects/systemd
```

This commit fixes this by explicitly generating an error instead of
silently ignoring the switch:
```bash
$ systemd-run --scope --working-directory=/tmp/ bash -c 'echo $(pwd)'
--working-directory is not supported in --scope mode.
```

20 months agoman: don't mention Socket files in Scope man page
Joost Heitbrink [Wed, 21 Sep 2022 18:57:09 +0000 (20:57 +0200)] 
man: don't mention Socket files in Scope man page

20 months agoMerge pull request #24709 from keszybz/partition-table-constants
Lennart Poettering [Wed, 21 Sep 2022 18:07:21 +0000 (20:07 +0200)] 
Merge pull request #24709 from keszybz/partition-table-constants

Expose various GPT UUIDs as public contants and link them up in docs

20 months agoMerge pull request #24753 from DaanDeMeyer/repart-squashfs
Lennart Poettering [Wed, 21 Sep 2022 17:49:10 +0000 (19:49 +0200)] 
Merge pull request #24753 from DaanDeMeyer/repart-squashfs

repart: Add squashfs support

20 months agoFix inverted rotation in the Positivo DUO #24769 (#24770)
Edson Juliano Drosdeck [Wed, 21 Sep 2022 17:46:42 +0000 (14:46 -0300)] 
Fix  inverted rotation in the Positivo DUO #24769 (#24770)

hwdb: Fix  inverted rotation in the Positivo DUO

Fixes: #24769
20 months agostub: fix conditionalization of initrd assembly
Lennart Poettering [Wed, 21 Sep 2022 14:42:26 +0000 (16:42 +0200)] 
stub: fix conditionalization of initrd assembly

We forgot to conditionalize this on pcrsig/pcrpkey too. So if you have
ne creds or sysext configured we actually wouldn't pass pcrsig/pcrpkey
along. Let's fix that.

20 months agosd-gpt: adjust comments and use UINT64_C() 24709/head
Zbigniew Jędrzejewski-Szmek [Sun, 18 Sep 2022 11:20:05 +0000 (13:20 +0200)] 
sd-gpt: adjust comments and use UINT64_C()

20 months agodocs/DPS: use the SD_GPT_* constants here too
Zbigniew Jędrzejewski-Szmek [Sat, 17 Sep 2022 11:01:11 +0000 (13:01 +0200)] 
docs/DPS: use the SD_GPT_* constants here too

20 months agonetworkctl: use "-" for empty fields
Zbigniew Jędrzejewski-Szmek [Tue, 20 Sep 2022 18:41:31 +0000 (20:41 +0200)] 
networkctl: use "-" for empty fields

This looks nicer. Some fields were already using "-" as fallback, e.g. Speed,
so this makes things more consistent too.

20 months agohostnamectl,localectl: use "(unset)" in empty fields
Zbigniew Jędrzejewski-Szmek [Tue, 20 Sep 2022 18:12:50 +0000 (20:12 +0200)] 
hostnamectl,localectl: use "(unset)" in empty fields

"n/a" is more ambiguous: not available or not set or maybe we didn't check it.
Let's just say directly that the field is not set.

20 months agorepart: Add squashfs support 24753/head
Daan De Meyer [Mon, 19 Sep 2022 18:26:15 +0000 (20:26 +0200)] 
repart: Add squashfs support

To make this work, we have to set up everything in a temporary
directory tree that we can pass to mksquashfs as a single directory.

To make the most common scenario more efficient, we skip the temporary
setup directory if we only get a single source tree destined to root
in the squashfs filesystem.

20 months agoMerge pull request #24751 from medhefgo/stub-x86
Daan De Meyer [Wed, 21 Sep 2022 09:12:59 +0000 (11:12 +0200)] 
Merge pull request #24751 from medhefgo/stub-x86

stub: Several fixes

20 months agoshared: Add squashfs support to make_filesystem()
Daan De Meyer [Mon, 19 Sep 2022 18:24:55 +0000 (20:24 +0200)] 
shared: Add squashfs support to make_filesystem()

The caveat is that the caller has to provide a source directory
to initialize the squashfs filesystem from.

20 months agoMerge pull request #24522 from yuwata/core-device-drop-nonexistent-devlink-unit
Daan De Meyer [Wed, 21 Sep 2022 08:30:51 +0000 (10:30 +0200)] 
Merge pull request #24522 from yuwata/core-device-drop-nonexistent-devlink-unit

core/device: drop nonexistent devlink units

20 months agokernel-install.8: fix -h/-v ordering in SYNOPSIS
наб [Tue, 20 Sep 2022 23:21:20 +0000 (01:21 +0200)] 
kernel-install.8: fix -h/-v ordering in SYNOPSIS

20 months agokernel-install/90-loaderentry: fix chown
наб [Tue, 20 Sep 2022 23:05:37 +0000 (01:05 +0200)] 
kernel-install/90-loaderentry: fix chown

20 months agotest-17-udev: test that device units for nonexistent devlink are removed 24522/head
Yu Watanabe [Wed, 31 Aug 2022 19:40:21 +0000 (04:40 +0900)] 
test-17-udev: test that device units for nonexistent devlink are removed

For issue #24518.

20 months agotest-64-storage: add test for renaming lvm volume
Yu Watanabe [Wed, 31 Aug 2022 19:12:25 +0000 (04:12 +0900)] 
test-64-storage: add test for renaming lvm volume

20 months agotest-64-udev-storage: check device units
Yu Watanabe [Wed, 31 Aug 2022 18:48:02 +0000 (03:48 +0900)] 
test-64-udev-storage: check device units

20 months agocore/device: check that no unit is ready and not simultaneously
Yu Watanabe [Tue, 20 Sep 2022 18:30:11 +0000 (03:30 +0900)] 
core/device: check that no unit is ready and not simultaneously

This should not happen, just for safety.

20 months agocore/device: refuse alias with ".."
Yu Watanabe [Tue, 20 Sep 2022 18:13:46 +0000 (03:13 +0900)] 
core/device: refuse alias with ".."

20 months agocore/device: always update existing devlink or alias units on uevent
Yu Watanabe [Wed, 31 Aug 2022 16:17:27 +0000 (01:17 +0900)] 
core/device: always update existing devlink or alias units on uevent

Previously, existing device units for devlinks or aliases were not
removed unless the main device unit is removed. This makes all existing
device units for devlinks and aliases are checked if they are still
required, and remove if not necessary anymore.

Fixes #24518.

20 months agotest: don't overwrite existing $QEMU_OPTIONS
Frantisek Sumsal [Tue, 20 Sep 2022 17:12:18 +0000 (19:12 +0200)] 
test: don't overwrite existing $QEMU_OPTIONS

20 months agomkosi: Set ExtraSearchPaths=build/ by default
Daan De Meyer [Tue, 20 Sep 2022 18:24:10 +0000 (20:24 +0200)] 
mkosi: Set ExtraSearchPaths=build/ by default

When hacking on systemd, let's have mkosi prefer executables from
the build directory over the system ones.

20 months agoMerge pull request #24521 from poettering/boot-loader-spec-dollar-boot-fix
Lennart Poettering [Tue, 20 Sep 2022 19:51:22 +0000 (21:51 +0200)] 
Merge pull request #24521 from poettering/boot-loader-spec-dollar-boot-fix

boot loader spec fixes

20 months agoboot-loader-spec: undo redefinition of $BOOT 24521/head
Lennart Poettering [Wed, 31 Aug 2022 16:43:24 +0000 (18:43 +0200)] 
boot-loader-spec: undo redefinition of $BOOT

In 53c26db4dac0f5b79ca2a57364ee7df78a14bbfd the meaning of $BOOT was
redefined. I think that's quite problematic, since the concept is
implemented in code and interface of bootctl. Thus, I think we should
stick to the original definition, which is: "where to *place* boot menu
entries" (as opposed to "where to *read* boot menu entries from").

The aforementioned change was done to address two things afaiu:

1. it focussed on a $BOOT as the single place to put boot entries in,
   instead of mentioning that both ESP and $BOOT are expected to be
   the source

2. it mentioned the /loader/ dir (as location for boot loader resources)
   itself as part of the spec, which however only really makes sense in
   the ESP. /loader/entries/ otoh makes sense in either the ESP or
   $BOOT.

With this rework I try to address these two issues differently:

1. I intend to make clear the $BOOT is the "primary" place to put stuff
   in, and is what should be mounted to /boot/.

2. The ESP (if different from $BOOT) is listed as "secondary" source to
   read from, and is what should be mounted to /efi/. NB we now make the
   distinction between "where to put" (which is single partition) and
   "where to read from".

3. This drops any reference of the /loader/ dir witout the /entries/
   suffix. Only the full /loader/entries/ dir (and its companion file
   /loader/entries.srel) are now mentioned. Thus isolated /loader/
   directory hence becomes irrelevant in the spec, and the fact that
   sd-boot maintains some files there (and only in the ESP) is kept out
   of the spec, because it is irrelevant to other boot loaders.

4. It puts back the suggestion to mount $BOOT to /boot/ and the ESP to
   /efi/ (and suggests adding a symlink or bind mount if both are the
   same partition). Why? Because the dirs are semantically unrelated:
   it's OK and common to have and ESP but no $BOOT, hence putting ESP
   inside of a useless, non-existing "ghost" dir /boot/ makes little
   sense. More importantly though, because these partitions are
   typically backed by VFAT we want to maintain them as an autofs, with
   a short idle delay, so that the file systems are unmounted (and thus
   fully clean) at almost all times. This doesn't work if they are
   nested within each other, as the establishment of the inner autofs
   would pin the outer one, making the excercise useless. Now I don't
   think the spec should mention autofs (since that is an implementation
   detail), but it should arrange things so that this specific, very
   efficient, safe and robust implementation can be implemented.

The net result should be easy from an OS perspective:

1. *Put* boot loader entries in /boot/, always.

2. *Read* boot loader entries from both /boot/ and /efi/ -- if these are distinct.

3. The only things we define in the spec are /loader/entries/*.conf and
   /EFI/Linux/*.efi in these two partitions (well, and the companion
   file /loader/entries.srel

4. /efi/ and /boot/ because not nested can be autofs.

5. bootctl code and interface (in particular --esp-path= and
   --boot-path=) match the spec again. `bootctl -x` and `bootctl -p`
   will now print the path to $BOOT and ESP again, matching the concepts
   in the spec again.

From the sd-boot perspective things are equally easy:

1. Read boot enrties from ESP and XBOOTLDR.

2. Maintain boot loader config/other resources in ESP only.

And that's it.

Fixes: #24247
20 months agoboot-loader-spec: fix typo
Lennart Poettering [Wed, 31 Aug 2022 16:31:02 +0000 (18:31 +0200)] 
boot-loader-spec: fix typo

20 months agoboot-loader-spec: add comment about case sensitivity of file names
Lennart Poettering [Wed, 31 Aug 2022 16:30:33 +0000 (18:30 +0200)] 
boot-loader-spec: add comment about case sensitivity of file names

20 months agoTODO: drop support for unmerged-usr in H2 2023
Luca Boccassi [Tue, 20 Sep 2022 19:08:18 +0000 (20:08 +0100)] 
TODO: drop support for unmerged-usr in H2 2023

20 months agocore/device: introduce device_propagate_reload()
Yu Watanabe [Thu, 1 Sep 2022 01:21:30 +0000 (10:21 +0900)] 
core/device: introduce device_propagate_reload()

20 months agocore/device: introduce device_by_path() helper function
Yu Watanabe [Thu, 1 Sep 2022 00:01:19 +0000 (09:01 +0900)] 
core/device: introduce device_by_path() helper function

20 months agocore/device: removed devices are not ready
Yu Watanabe [Thu, 1 Sep 2022 00:02:39 +0000 (09:02 +0900)] 
core/device: removed devices are not ready

20 months agocore/device: use DEVICE_NOT_FOUND
Yu Watanabe [Wed, 31 Aug 2022 21:35:22 +0000 (06:35 +0900)] 
core/device: use DEVICE_NOT_FOUND

20 months agomeasure: separate out PE section options in --help text 24620/head
Lennart Poettering [Fri, 9 Sep 2022 16:30:03 +0000 (18:30 +0200)] 
measure: separate out PE section options in --help text

Let's separate the PE section options in the --help text to make clearer
that they are about PE sections, and thus make things less confusing
regarding the cryptic names. Specifically, there's now a separate
section in the --help text that looks like this:

<snip>
UKI PE Section Options:                                         UKI PE Section
     --linux=PATH        Path Linux kernel image                → .linux
     --osrel=PATH        Path to os-release file                → .osrel
     --cmdline=PATH      Path to file with kernel command line  → .cmdline
     --initrd=PATH       Path to initrd image                   → .initrd
     --splash=PATH       Path to splash bitmap                  → .splash
     --dtb=PATH          Path to Devicetree file                → .dtb
     --pcrpkey=PATH      Path to public key for PCR signatures  → .pcrpkey
</snipe>

(The section title is underlined, like we usually do it)

I think separating this out, and organizing the section name in tabular
form emphasizes nicely where this switches get their name from and what
they mean.

Hopefully addresses concerns from
https://github.com/systemd/systemd/pull/24458#discussion_r967052720 in a
diferent way.

(Also dropped a hint regarding DER format for public key. it's simply
wrong, we use PEM like everyone else on Linux. Outside of Java land DER
isn't popular, so we don't need to mention it here in the --help text,
man page should be enough.)

20 months agostub: typo fix in comment
Lennart Poettering [Fri, 9 Sep 2022 16:29:24 +0000 (18:29 +0200)] 
stub: typo fix in comment

https://github.com/systemd/systemd/pull/24458#discussion_r966941104

20 months agoMerge pull request #24711 from poettering/verify_fsroot_dir-rework
Yu Watanabe [Tue, 20 Sep 2022 15:56:00 +0000 (00:56 +0900)] 
Merge pull request #24711 from poettering/verify_fsroot_dir-rework

find-esp: rework verify_fsroot_dir()  a bit

20 months agorecurse-dir: use fd_reopen() at one more place
Lennart Poettering [Tue, 20 Sep 2022 11:39:29 +0000 (13:39 +0200)] 
recurse-dir: use fd_reopen() at one more place

Inspired by 83b94cf10e4f76b2b415bc70bf65f1c28698b97c

20 months agoDelete CNAME
Zbigniew Jędrzejewski-Szmek [Tue, 20 Sep 2022 15:46:40 +0000 (17:46 +0200)] 
Delete CNAME

20 months agorepart: Rename fs to root in do_copy_files() and do_make_directories()
Daan De Meyer [Mon, 19 Sep 2022 17:42:13 +0000 (19:42 +0200)] 
repart: Rename fs to root in do_copy_files() and do_make_directories()

Preparation for future commits

20 months agoman/systemd-gpt-auto-generator: reword phrasing about partition location
Zbigniew Jędrzejewski-Szmek [Sat, 17 Sep 2022 10:19:31 +0000 (12:19 +0200)] 
man/systemd-gpt-auto-generator: reword phrasing about partition location

"located on the same disk as the ESP is located on" is hard to grok. Let's
use more natural phrasing. Also, we shouldn't say that "The first foo partition
… is mounted to …", because this doesn't explain what is happening. The
partition could be empty, and there could be other partitions with the "foo"
content, but what matters is the UUID.

20 months agoman/systemd-gpt-auto-generator: export type flags by name, trim table
Zbigniew Jędrzejewski-Szmek [Sat, 17 Sep 2022 10:02:53 +0000 (12:02 +0200)] 
man/systemd-gpt-auto-generator: export type flags by name, trim table

We listed many of the root-partition type uuids, but not all. I think the
chances of somebody using the discoverable partition magic on an Itanium system
are fairly low at this point. So let's remove all architectures except the two
most popular consumer architectures. People building Longsoon or RISC-V images
are likely to have the online version of the Discoverable Partitions
Specifications handy anyway, and it makes the man page easier to read. It also
reduces the chances that somebody adding new entries to the table has some
select&paste mishap. We've already had this happen in the past and it's fairly
nasty bug. We don't need to expose the information in two places with manual
propagation between them.

20 months agosd-gpt, docs: define s390 before s390x
Zbigniew Jędrzejewski-Szmek [Thu, 15 Sep 2022 15:53:28 +0000 (17:53 +0200)] 
sd-gpt, docs: define s390 before s390x

In all other cases we have the older variant before the newer. And since we
generate some documentation tables from the header, this order is also visible
for users. Let's restore the order. This commit does
4565246911adbdd1b20d8944c0754772788a768c in a slightly different fashion.

20 months agotools/list-discoverable-partitions: make the script work again
Zbigniew Jędrzejewski-Szmek [Thu, 15 Sep 2022 15:57:24 +0000 (17:57 +0200)] 
tools/list-discoverable-partitions: make the script work again

20 months agoheaders: export partition uuids and flags in new sd-gpt.h file
Zbigniew Jędrzejewski-Szmek [Thu, 15 Sep 2022 15:48:16 +0000 (17:48 +0200)] 
headers: export partition uuids and flags in new sd-gpt.h file

I think those constants are generally useful. It's quite easy to make a mistake
when copying things from the docs, so let's make them easy and convenient to
access.

20 months agoman: "the initial RAM disk" → "the initrd"
Zbigniew Jędrzejewski-Szmek [Thu, 15 Sep 2022 12:43:59 +0000 (13:43 +0100)] 
man: "the initial RAM disk" → "the initrd"

In many places we spelled out the phrase behind "initrd" in full, but this
isn't terribly useful. In fact, no "RAM disk" is used, so emphasizing this
is just confusing to the reader. Let's just say "initrd" everywhere, people
understand what this refers to, and that it's in fact an initramfs image.

Also, s/i.e./e.g./ where appropriate.

Also, don't say "in RAM", when in fact it's virtual memory, whose pages
may or may not be loaded in page frames in RAM, and we have no control over
this.

Also, add <filename></filename> and other minor cleanups.

20 months agodocs: add a note about selectively overriding default dependencies
Luca BRUNO [Mon, 19 Sep 2022 10:09:17 +0000 (10:09 +0000)] 
docs: add a note about selectively overriding default dependencies

This documents that explicit `Before=`/`After=` dependencies can be
used to selectively override implicit ordering coming from default
dependencies. That allows for more granular control compared to the
already documented `DefaultDependencies=no` option.

The alternative approach came up in a discussion around the ordering
of `boot-complete.target`, so this also adds an explicit suggestion
in that direction to the "Automatic Boot Assessment" documentation.

Ref: https://lists.freedesktop.org/archives/systemd-devel/2022-September/048330.html

20 months agofind-esp: when searching, don't trip over inodes we expect to be dirs to be something... 24711/head
Lennart Poettering [Mon, 19 Sep 2022 14:50:46 +0000 (16:50 +0200)] 
find-esp: when searching, don't trip over inodes we expect to be dirs to be something else, just continue searching

20 months agofind-esp: rework verify_fsroot_dir() around statx()
Lennart Poettering [Sat, 17 Sep 2022 17:57:14 +0000 (19:57 +0200)] 
find-esp: rework verify_fsroot_dir() around statx()

Let's rework verify_fsroot_dir() around two statx() calls, which should
usually give us all information we need. Let's then add a call to the
btrfs ioctl only if the caller actually wants to know the backing block
device (which it generally only wants if it then intends to verify
partition type, and similar).

This makes things more robust on new kernels, and bypasses the btrfs
ioctls in environments where we cannot actually interpret the results
properly (since they reference btrfs devices via /dev/ paths, which we
likely cannot resolve in containers)

Fixes: #24616
20 months agostat-util: add statx_mount_same() to check if two stax refer to the same mount
Lennart Poettering [Tue, 20 Sep 2022 11:39:51 +0000 (13:39 +0200)] 
stat-util: add statx_mount_same() to check if two stax refer to the same mount

20 months agostat-util: add statx_inode_same() helper to check if two statx structs refer to same...
Lennart Poettering [Mon, 19 Sep 2022 14:51:08 +0000 (16:51 +0200)] 
stat-util: add statx_inode_same() helper to check if two statx structs refer to same inode

The same as stat_inode_same(), but for struct statx rather than struct
stat.

20 months agochase-symlinks: don't insist on absolute paths if CHASE_PREFIX_ROOT is set
Lennart Poettering [Sat, 17 Sep 2022 17:53:19 +0000 (19:53 +0200)] 
chase-symlinks: don't insist on absolute paths if CHASE_PREFIX_ROOT is set

There's little reason to require this, given that we can just say that
if a relative path is specified it is to be read relative to the root.

This fixes a bootctl bug introduced by
3730dc5d5b4b7c4e1e7d0957c88568cc45de2390 which didn't bother prefixing
paths as necessary.

20 months agoblockdev-util: make sure get_block_device_fd() works reliably for O_PATH, too
Lennart Poettering [Mon, 19 Sep 2022 12:23:02 +0000 (14:23 +0200)] 
blockdev-util: make sure get_block_device_fd() works reliably for O_PATH, too

20 months agotest-blockdev-util: check if r is actually a failure before ERRNO_IS_PRIVILEGE
Lennart Poettering [Sat, 17 Sep 2022 17:45:08 +0000 (19:45 +0200)] 
test-blockdev-util: check if r is actually a failure before ERRNO_IS_PRIVILEGE

20 months agostub: Always use LINUX_INITRD_MEDIA_GUID if available 24751/head
Jan Janssen [Tue, 20 Sep 2022 08:08:05 +0000 (10:08 +0200)] 
stub: Always use LINUX_INITRD_MEDIA_GUID if available

The kernel PE image version can be used to detect support for this
feature, allowing us to prefer the generic code of the deprecated EFI
handover protocol.

20 months agostub: Be explicit about EFI handover calling convention
Jan Janssen [Tue, 20 Sep 2022 07:30:40 +0000 (09:30 +0200)] 
stub: Be explicit about EFI handover calling convention

20 months agostub: Remove unnecessary asm cli call
Jan Janssen [Tue, 20 Sep 2022 07:27:27 +0000 (09:27 +0200)] 
stub: Remove unnecessary asm cli call

Apparently, this is not needed when red zones are disabled and we do
that.

20 months agostub: Properly clean up pages on error
Jan Janssen [Sun, 18 Sep 2022 08:39:32 +0000 (10:39 +0200)] 
stub: Properly clean up pages on error

20 months agostub: Refuse operation if kernel lacks EFI handover support
Jan Janssen [Sat, 17 Sep 2022 20:35:23 +0000 (22:35 +0200)] 
stub: Refuse operation if kernel lacks EFI handover support

20 months agostub: Refuse operating above 4G if not supported
Jan Janssen [Sat, 17 Sep 2022 20:24:51 +0000 (22:24 +0200)] 
stub: Refuse operating above 4G if not supported

We could try to relocate these but that is probably not needed. So far
we have not been bitten by this in the real world and kernels we boot
likely already support this anyway.

20 months agostub: Provide a proper boot params page
Jan Janssen [Sat, 17 Sep 2022 20:02:42 +0000 (22:02 +0200)] 
stub: Provide a proper boot params page

The boot params passed to the kernel only has to be one page in size
and the size of the setup header has to be calculated as it depends on
the boot protocol version supported by the kernel.

20 months agostub: Fix above 4G boot
Jan Janssen [Sat, 17 Sep 2022 09:47:39 +0000 (11:47 +0200)] 
stub: Fix above 4G boot

The kernel x86 boot protocol does not expect this value to be set when
using EFI handover protocol. If the stub is loaded above 4G we would
end up discarding the high bits, breaking boot.

Fixes: #24707
20 months agoboot: Change the way we provide builtins
Jan Janssen [Sat, 10 Sep 2022 14:56:48 +0000 (16:56 +0200)] 
boot: Change the way we provide builtins

Relying on symbol aliasing seems to be rather unreliable. Instead just
use some light #ifdefery.

Fixes: #24630
20 months agoudev: use block_device_is_whole_disk()
Yu Watanabe [Tue, 20 Sep 2022 00:04:54 +0000 (09:04 +0900)] 
udev: use block_device_is_whole_disk()

No functional changes, just refactoring.

Note, this also makes synthesize_change() propagate the error from
synthesize_change_one(). However, the caller of synthesize_change()
ignores the failure anyway, hence the change does not take any effect.

20 months agosd-device: use fd_reopen() at one more place
Yu Watanabe [Tue, 20 Sep 2022 00:26:50 +0000 (09:26 +0900)] 
sd-device: use fd_reopen() at one more place

It provides recognizable error if /proc is not mounted.

20 months agocryptsetup: use TPM flags over bool
William Roberts [Mon, 19 Sep 2022 18:50:03 +0000 (13:50 -0500)] 
cryptsetup: use TPM flags over bool

This works becuase TPM2_FLAGS_USE_PIN is 1 and bool is a 1 so the bits
line up as expected, however if for some reason flags change values and
for clarity check if the boolean indicates this flag and pass the flag
value.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
20 months agomeson: make several tests run sequentially
Yu Watanabe [Mon, 19 Sep 2022 14:40:34 +0000 (23:40 +0900)] 
meson: make several tests run sequentially

Follow-up for f93ba375301e43900f1fe5a93a2b33b1efcc73e0.

20 months agoMerge pull request #24744 from yuwata/mkdir-chase-symlinks
Yu Watanabe [Mon, 19 Sep 2022 16:43:00 +0000 (01:43 +0900)] 
Merge pull request #24744 from yuwata/mkdir-chase-symlinks

mkdir: chase_symlinks_and_stat() does not return 0

20 months agoMerge pull request #24731 from yuwata/sd-device-opendir
Daan De Meyer [Mon, 19 Sep 2022 15:06:38 +0000 (17:06 +0200)] 
Merge pull request #24731 from yuwata/sd-device-opendir

sd-device: introduce device_opendir()

20 months agotest: add more test cases for mkdir_p_safe() and mkdir_p_root() 24744/head
Yu Watanabe [Thu, 25 Aug 2022 22:19:59 +0000 (07:19 +0900)] 
test: add more test cases for mkdir_p_safe() and mkdir_p_root()

20 months agomkdir: chase_symlinks_and_stat() does not return 0
Yu Watanabe [Thu, 25 Aug 2022 22:50:32 +0000 (07:50 +0900)] 
mkdir: chase_symlinks_and_stat() does not return 0

This reverts commits e22916e61d1fdb7b46918b605ebf783d9017f9d8 and
1e146d738232acbe7f72903e9c5e4d1166ea67f5.

20 months agoMerge pull request #24742 from keszybz/hwdb-252
Yu Watanabe [Mon, 19 Sep 2022 13:51:13 +0000 (22:51 +0900)] 
Merge pull request #24742 from keszybz/hwdb-252

hwdb update for v252-rc1

20 months agotpm2-util: make tpm2_pcr_bank_from_string() case-insensitive
Lennart Poettering [Fri, 16 Sep 2022 21:42:05 +0000 (23:42 +0200)] 
tpm2-util: make tpm2_pcr_bank_from_string() case-insensitive

This way we can use it directly in measure.c, and thus remove a bit of
redundant code.

OpenSSL prefers uppercasing the MD names, others don't hence let's be
lenient here.

20 months agoudev: use device_opendir() 24731/head
Yu Watanabe [Sun, 18 Sep 2022 22:36:09 +0000 (07:36 +0900)] 
udev: use device_opendir()

20 months agosd-device: use device_opendir()
Yu Watanabe [Sun, 18 Sep 2022 22:08:59 +0000 (07:08 +0900)] 
sd-device: use device_opendir()

20 months agosd-device: introduce device_opendir()
Yu Watanabe [Mon, 29 Aug 2022 20:23:05 +0000 (05:23 +0900)] 
sd-device: introduce device_opendir()

20 months agohwdb: run "update-hwdb-autosuspend" 24742/head
Zbigniew Jędrzejewski-Szmek [Thu, 18 Aug 2022 08:47:36 +0000 (10:47 +0200)] 
hwdb: run "update-hwdb-autosuspend"

20 months agohwdb: run "update-hwdb"
Zbigniew Jędrzejewski-Szmek [Mon, 19 Sep 2022 10:26:33 +0000 (12:26 +0200)] 
hwdb: run "update-hwdb"

As usual, it seems to be mostly additions and corrections. Sadly, it seems a
bit of mojibake has crept in in various places. But it's hard to correct, in
particular because it's hard to detect all cases automatically. I think we can
ignore this for now.

When I run this a few weeks ago, ma-large.txt was gutted and 20-OUI.hwdb was
siginificantly smaller. For whatever reasons, it's back to normal now.

20 months agoudev: use sd_device_get_sysattr_value()
Yu Watanabe [Sun, 18 Sep 2022 22:34:49 +0000 (07:34 +0900)] 
udev: use sd_device_get_sysattr_value()

No functional changes, just refactoring.

20 months agoudev: use faccessat()
Yu Watanabe [Sun, 18 Sep 2022 22:32:44 +0000 (07:32 +0900)] 
udev: use faccessat()

No functional changes, just refactoring.

20 months agosd-device: re-implement device_sysattrs_read_all() without recursion
Yu Watanabe [Sun, 18 Sep 2022 22:04:37 +0000 (07:04 +0900)] 
sd-device: re-implement device_sysattrs_read_all() without recursion

20 months agosd-device: use faccessat()
Yu Watanabe [Sun, 18 Sep 2022 22:23:30 +0000 (07:23 +0900)] 
sd-device: use faccessat()

No functional changes, just refactoring.

20 months agosd-device: use fstatat()
Yu Watanabe [Sun, 18 Sep 2022 22:08:13 +0000 (07:08 +0900)] 
sd-device: use fstatat()

No functional changes, just refactoring.

20 months agosd-device: use path_hash_ops to store sysattrs
Yu Watanabe [Sun, 18 Sep 2022 22:03:21 +0000 (07:03 +0900)] 
sd-device: use path_hash_ops to store sysattrs

As the stored values are actually path. Just for safety.

This also drops unnecessary duplication of path.

20 months agoalso provide credentials in ExecStartPre
Jörg Thalheim [Fri, 16 Sep 2022 12:41:58 +0000 (14:41 +0200)] 
also provide credentials in ExecStartPre

Systemd's credential interface is not yet natively supported by all
programs yet. Hence it's often required to run scripts to massage
secrets in the way the programs expect it.

This commit allows the ExecStartPre commands to access credentials.

Fixes https://github.com/systemd/systemd/issues/19604

20 months agotest: add testcase for link priority
Yu Watanabe [Fri, 15 Apr 2022 02:13:29 +0000 (11:13 +0900)] 
test: add testcase for link priority

20 months agoMerge pull request #24646 from yuwata/udev-node-symlink_atomic
Yu Watanabe [Sun, 18 Sep 2022 20:25:58 +0000 (05:25 +0900)] 
Merge pull request #24646 from yuwata/udev-node-symlink_atomic

udev: introduce symlink_atomic_full() and use it

20 months agoMerge pull request #24725 from yuwata/blockdev-util-introduce-block_device_get_whole_disk
Yu Watanabe [Sun, 18 Sep 2022 20:25:09 +0000 (05:25 +0900)] 
Merge pull request #24725 from yuwata/blockdev-util-introduce-block_device_get_whole_disk

blockdev-util: introduce block_device_get_whole_disk()

20 months agoMerge pull request #24730 from yuwata/dissect-image-drop-reference-to-decrypted-image
Yu Watanabe [Sun, 18 Sep 2022 20:24:35 +0000 (05:24 +0900)] 
Merge pull request #24730 from yuwata/dissect-image-drop-reference-to-decrypted-image

dissect-image: introduce dissected_image_relinquish()

20 months agoman/systemd-run: Refer to man-pages project (man7.org) when citing bash(1)
BerndAdameit [Sun, 18 Sep 2022 10:20:32 +0000 (12:20 +0200)] 
man/systemd-run: Refer to man-pages project (man7.org) when citing bash(1)

20 months agopath-util: add examples for path_make_relative() and path_make_relative_parent()
Yu Watanabe [Sun, 18 Sep 2022 14:19:13 +0000 (23:19 +0900)] 
path-util: add examples for path_make_relative() and path_make_relative_parent()

Addresses https://github.com/systemd/systemd/pull/24646#discussion_r973691797.

20 months agotree-wide: drop unused reference to DecryptedImage 24730/head
Yu Watanabe [Sun, 11 Sep 2022 15:07:17 +0000 (00:07 +0900)] 
tree-wide: drop unused reference to DecryptedImage