1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00
Commit Graph

58979 Commits

Author SHA1 Message Date
Lennart Poettering
71c943dc40 mountpoint-util: make fd_is_mountpoint() work reasonably with AT_EMPTYPATH
Inspired by: https://github.com/systemd/systemd/pull/24141

Calling fd_is_mountpoint() with AT_EMPTYPATH and an empty filename can
only work if we have new statx() available. If we do not, we can still
make things work for directories, but not for other inodes (since there
we cannot query information about the parent inode to compare things.)

Hence, let's handle and test this explicitly, to support this to the
level this is possible.
2022-08-02 20:01:59 +02:00
Jacek Migacz
ff0a5070d4 resolved: fix single-label resolution over DNS
Fixes: #23494 (when ResolveUnicastSingleLabel=yes)
2022-08-02 19:21:46 +02:00
Luca Boccassi
675a644de2
Merge pull request #24146 from poettering/efi-stub-measure-payload
stub: measure kernel/initrd/parameters into clean PCRs 11/12/13, and add "systemd-measure" tool to be able to pre-calculate values
2022-08-02 14:42:33 +01:00
Lennart Poettering
7f8258b4a3 update TODO 2022-08-02 14:01:37 +02:00
Daan De Meyer
859614439a mkosi: Update to latest commit
With this update, Arch Linux keyring updates will be automatically
pulled in instead of having to update to a new mkosi commit every
time the keyring gets outdated.
2022-08-02 12:58:31 +02:00
Lennart Poettering
c0a74f6286 update TODO 2022-08-02 10:29:04 +02:00
Lennart Poettering
984638cde7 test: add trivial test for systemd-measure 2022-08-02 10:28:49 +02:00
Lennart Poettering
ca1092dc15 measure: add new tool to precalculate PCR values for a kernel image
For now, this simply outputs the PCR hash values expected for a kernel
image, if it's measured like sd-stub would do it.

(Later on, we can extend the tool, to optionally sign these
pre-calculated measurements, in order to implement signed PCR policies
for disk encryption.)
2022-08-02 10:28:49 +02:00
Lennart Poettering
51470e1e56 bootctl: suppress "Boot Loaders Listed in EFI Variables" section header if section empty
Some more cosmetics.
2022-08-02 10:28:49 +02:00
Lennart Poettering
84be9b63eb bootctl: prettify tree output of discovered boot loaders a bit
Previously, the tree output of discovered boot laoders in the ESP would
look like this:

Available Boot Loaders on ESP:
          ESP: /efi (/dev/disk/by-partuuid/0c6f41ed-2573-4723-8c84-23681f9d1c28)
         File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot v250.7-1.fc36)
         File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot v250.7-1.fc36)

With this change the tree branches are corrected to look like this:

Available Boot Loaders on ESP:
          ESP: /efi (/dev/disk/by-partuuid/0c6f41ed-2573-4723-8c84-23681f9d1c28)
         File: ├─/EFI/systemd/systemd-bootx64.efi (systemd-boot v250.7-1.fc36)
               └─/EFI/BOOT/BOOTX64.EFI (systemd-boot v250.7-1.fc36)

Ahhh! So much nicer. This incorrect tree drawing has been bugging me for
so long. Finally I can sleep at night again!
2022-08-02 10:28:49 +02:00
Lennart Poettering
cb180369f1 bootctl: underline sections in status output
Let's give the output a bit more structure, inspired by the way our
newer --help texts use underlining to separate out sections a bit.
2022-08-02 10:28:49 +02:00
Lennart Poettering
257bc3ef60 boot: add hexdump helper call
This is not actually used (or even supposed to be used) in clean
codepaths, but is tremendously useful when verifying things work
correctly, as a debugging tool.
2022-08-02 10:28:49 +02:00
Lennart Poettering
a67f22c4a7 boot: add three new boot loader feature flags
Report whether the devicetree + sort-key boot loader spec type #1
fields are supported, and whether the "@saved" pseudo-entry is
supported.

Strictly speaking, thes features have been added in versions that are
already released (250+), so by adding this those version even though
they support the features will be considered not supporting them, but
that should be OK (the opposite would be a problem though, i.e. if we'd
assume a boot loader had a feature it actually does not).

These three features are features relevant to userspace, as it allows
userspace to tweak/genereate BLS entries or set EFI vars correctly.
Other features (i.e. that have no impliciations to userspace) are not
reported.
2022-08-02 10:28:49 +02:00
Lennart Poettering
6977ea9975 bootctl: show stub feature set in status output 2022-08-02 10:28:49 +02:00
Lennart Poettering
03d5449f3a stub: clean up kernel command line when converting to ASCII
Let's be a bit more careful when converting the UTF-16 cmdline to ASCII.
Let's convert all characters out of the printable ASCII range to spaces,
instead of blindly relying on C's downcasting behaviour.
2022-08-02 10:28:49 +02:00
Lennart Poettering
46d336722d stub: introduce StubFeatures, similar to LoaderFeatures
systemd-boot reports its features via the LoaderFeatures EFI variable.
Let's add something similar for stub features, given they have been
growing.

For starters only define four feature flags. One is a baseline feature
we pretty much always supported (see comment in code), two are features
added in one of the most recently released systemd version, and the
final one, is a feature we added a few commits ago.

This is useful for userspace to figure out what is supported and what
not.
2022-08-02 10:28:49 +02:00
Lennart Poettering
6017eee9ce boot: move unified kernel PE section definitions into 'fundamental' code
Le's share this code between userspace and uefispace. This is useful
later when pre-measuring expected PCRs from userspace.
2022-08-02 10:28:49 +02:00
Lennart Poettering
aa323c0907 boot: split out TPM PCR defines into header file we can share between userspace and kernel space 2022-08-02 10:28:49 +02:00
Lennart Poettering
de7ad6d4f4 sd-stub: measure sysext images picked up by sd-stub into PCR 13
Let's grab another so far unused PCR, and measure all sysext images into
it that we load from the ESP. Note that this is possibly partly redundant,
since sysext images should have dm-verity enabled, and that is hooked up
to IMA. However, measuring this explicitly has the benefit that we can
measure filenames too, easily, and that all without need for IMA or
anything like that.

This means: when booting a unified sd-stub kernel through sd-boot we'll
now have:

1. PCR 11: unified kernel image payload (i.e. kernel, initrd, boot
   splash, dtb, osrelease)

2. PCR 12: kernel command line (i.e. the one embedded in the image, plus
   optionally an overriden one) + any credential files picked up by
   sd-stub

3. PCR 13: sysext images picked up by sd-stub

And each of these three PCRs should carry just the above, and start from
zero, thus be pre-calculatable.

Thus, all components and parameters of the OS boot process (i.e.
everything after the boot loader) is now nicely pre-calculable.

NOTE: this actually replaces previous measuring of the syext images into
PCR 4. I added this back in 845707aae2,
following the train of thought, that sysext images for the initrd should
be measured like the initrd itself they are for, and according to my
thinking that would be a unified kernel which is measured by firmware
into PCR 4 like any other UEFI executables.

However, I think we should depart from that idea. First and foremost
that makes it harder to pre-calculate PCR 4 (since we actually measured
quite incompatible records to the TPM event log), but also I think
there's great value in being able to write policies that bind to the
used sysexts independently of the earlier boot chain (i.e. shim, boot
loader, unified kernel), hence a separate PCR makes more sense.

Strictly speaking, this is a compatibility break, but I think one we can
get away with, simply because the initrd sysext images are currently not
picked up by systemd-sysext yet in the initrd, and because of that we
can be reasonably sure noone uses this yet, and hence relies on the PCR
register used. Hence, let's clean this up before people actually do
start relying on this.
2022-08-02 10:28:49 +02:00
Lennart Poettering
16700cb85a stub: measure PE sections in a defined order, and include all sections 2022-08-02 10:28:49 +02:00
Lennart Poettering
72c97c19c3 efi: from the stub measure the ELF kernel + built-in initrd and so on into PCR 11
Here we grab a new – on Linux so far unused (by my Googling skills, that
is) – and measure all static components of the PE kernel image into.
This is useful since for the first time we'll have a PCR that contains
only a PCR of the booted kernel, nothing else. That allows putting
together TPM policies that bind to a specific kernel (+ builtin initrd),
without having to have booted that kernel first. PCRs can be
pre-calculated. Yay!

You might wonder, why we measure just the discovered PE sections we are
about to use, instead of the whole PE image. That's because of the next
step I have in mind: PE images should also be able to carry an
additional section that contains a signature for its own expected,
pre-calculated PCR values. This signature data should then be passed
into the booted kernel and can be used there in TPM policies. Benefit:
TPM policies can now be bound to *signatures* of PCRs, instead of the
raw hash values themselves. This makes update management a *lot* easier,
as policies don't need to be updated whenever a kernel is updated, as
long as the signature is available. Now, if the PCR signature is
embedded in the kernel PE image it cannot be of a PCR hash of the kernel
PE image itself, because that would be a chicken-and-egg problem. Hence,
by only measuring the relavent payload sections (and that means
excluding the future section that will contain the PCR hash signature)
we avoid this problem, naturally.
2022-08-02 10:28:49 +02:00
Lennart Poettering
599fe002a1 efi: tell userspace where the stub measured the kernel command line/credentials into
This is useful for userspace to know, so that policies can be put
together safely, matching what the stub actually measured.
2022-08-02 10:28:49 +02:00
Lennart Poettering
8d5e4d59f2 efi: optionally report when measuring to TPM whether we actually did
the measurement calls can succeed either when they actually measured
something, or when they skipped measurement because the local system
didn't support TPMs.

Let's optionally return a boolean saying which case it is. This is later
useful to tell userspace how and if we measured something.
2022-08-02 10:28:49 +02:00
Lennart Poettering
c794e280e9 update TODO 2022-08-02 10:28:15 +02:00
Yu Watanabe
ee5cde205c
Merge pull request #24174 from yuwata/network-link-local-address
network: fix link local address handling
2022-08-02 12:56:01 +09:00
Yu Watanabe
e4e0b239f6 test-network: add test case for #23197 2022-08-02 03:43:04 +09:00
Yu Watanabe
bd7e0a3f1c network: make link_may_have_ipv6ll() optionally check Multicast= setting
Fixes the IPv6LL issue in #23197.
2022-08-02 03:35:00 +09:00
Yu Watanabe
5fb5fae933 network: fix possible NULL-pointer dereference 2022-08-02 03:32:55 +09:00
Yu Watanabe
e0c0cd49e5 network: do not try to start ipv4acd on non-supported interfaces
Fixes IPv4LL issue reported in #23197.
2022-08-02 03:06:21 +09:00
Yu Watanabe
29104ded1c network: split link_ipv4ll_enabled() into two
And move it from networkd-link.[ch] to relevant files.
2022-08-02 03:02:48 +09:00
Yu Watanabe
2d3d0e8f7d network: drop doubled semicolon 2022-08-02 02:44:37 +09:00
Yu Watanabe
5162b2a1c4 tree-wide: fix typo 2022-08-02 02:43:38 +09:00
dependabot[bot]
bc4b9a7117 build(deps): bump meson from 0.62.2 to 0.63.0 in /.github/workflows
Bumps [meson](https://github.com/mesonbuild/meson) from 0.62.2 to 0.63.0.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/0.62.2...0.63.0)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 14:06:32 +00:00
James Hilliard
6e8b2a71c7 bpf: set gcc std and compile flags
This should make gcc bpf compilation more reliable.
2022-08-01 21:35:44 +09:00
dependabot[bot]
c3ebbcf7cb build(deps): bump github/codeql-action from 2.1.15 to 2.1.17
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.15 to 2.1.17.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](3f62b754e2...0c670bbf04)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 11:17:18 +00:00
dependabot[bot]
cc7f5ac478 build(deps): bump github/super-linter from 4.9.4 to 4.9.5
Bumps [github/super-linter](https://github.com/github/super-linter) from 4.9.4 to 4.9.5.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](a320804d31...2d64ac1c06)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 11:10:08 +00:00
dependabot[bot]
fdf38c0f1f build(deps): bump actions/setup-node from 3.3.0 to 3.4.1
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.3.0 to 3.4.1.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](eeb10cff27...2fddd8803e)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 10:06:54 +00:00
Cristian Rodríguez
91375fb9cf
gcrypt: switch to system rng before gcry_check_version (#24162)
Current docs claim this must be done before gcry_check_version.
2022-08-01 14:04:27 +09:00
Joaquín Ignacio Aramendía
e18569cc72 Add ACCEL_MOUNT_MATRIX for OXP Mini 2022-07-31 13:50:27 +09:00
Frantisek Sumsal
11d4ea2dbd
Merge pull request #24090 from yuwata/test-login
test: hopefully fixes race in TEST-35-LOGIN
2022-07-30 20:11:50 +00:00
Hugo Carvalho
1109a63ef2 Update LINGUAS
Sort language codes in alphabetical order
2022-07-31 03:41:19 +09:00
Yu Watanabe
3cf9c51e97 test: restart logind before cleaning up sessions
Hopefully, fixes #24040.
2022-07-31 00:15:47 +09:00
Yu Watanabe
54d5c126d3 test: do not restart getty@tty2 automatically 2022-07-31 00:15:47 +09:00
Yu Watanabe
fe9d58b25a test: terminate session and user on cleanup 2022-07-31 00:15:47 +09:00
Max Gautier
e0a12b9634 docs: Correct StandartOutput documentation
fix #2114
2022-07-30 13:48:36 +01:00
Luca Boccassi
60575af415
Merge pull request #24154 from yuwata/meson-fixups
meson: several fixlets
2022-07-30 13:48:09 +01:00
Eli Schwartz
9e4a50bcdf meson: fix broken boolean kwarg
Everywhere else that `conf.get('ENABLE_*')` is used as a boolean key for
something (for example in if statements) it always checks if == 1, but
in this one case it neglects to do so. This is important because
conf.get yields the same int that was stored, but if statements require
booleans.

So does executable's "install" kwarg, at least according to the
documentation. In actuality, it accepts all types without sanity
checking, then uses python "if bool(var)", so you can actually do
`install: 'do not'` and that's treated identical to `true`. This is a
type-checking bug which Meson will eventually fix.

muon fails on the same code, today.
2022-07-30 13:58:22 +09:00
Eli Schwartz
89cdbe1f08 meson: strip various strings before converting them to integers
"9\n" is not intrinsically a number, although some tools might
auto-strip strings before checking if they are a number. It's not
guaranteed, anyway.
2022-07-30 13:58:22 +09:00
Eli Schwartz
6c8892828c meson: use files in run_command with relativized path
Passing a file as a command argument in string form assumes that
run_command has the current subdir as its cwd, but Meson's documentation
*explicitly* calls this out as undefined and wrong to use.

Indeed, muon has a different implementation that uses a different cwd,
and this argument cannot be found. Instead, passing a files() object
means that it's the job of meson itself to verify the file exists, then
pass it to the run_command in some format that guarantees it is a valid
path reference.
2022-07-30 13:58:22 +09:00
Eli Schwartz
64a4277006 meson: move i18n module import to only when it is used
When translations are disabled, it's not necessary to `import('i18n')`
and do nothing with it. Also, importing it is (slightly) slow as Meson
needs to load another implementation file from disk, so why bother with
that work?

More particularly, muon does not yet implement this module and fails to
setup. Since there's already an option to disable using it, it makes
sense to let that option completely skip the not-implemented
functionality and actually succeed.
2022-07-30 13:58:22 +09:00