1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00
Commit Graph

53460 Commits

Author SHA1 Message Date
Lennart Poettering
f7c9ade22f smack-util: tiny simplification 2021-09-23 21:15:46 +02:00
Lennart Poettering
8e8415e0d5 boot: prefer IMAGE_VERSION from os-release as version string
If the field exists it's probably the best version we have for sorting,
since it will change on every single OS image update.
2021-09-23 17:48:26 +02:00
Lennart Poettering
99d51ed939 man: document the new systemd-boot drop-in driver dir logic 2021-09-23 17:24:28 +02:00
Lennart Poettering
b8cdb66279 man: the sd-boot menu is probably more "textual" then "graphical", hence don't lie
(also, most communication happens between boot loader and OS, only
seldom stuff goes the other way, hence mention that the boot loader
first)
2021-09-23 17:24:28 +02:00
Lennart Poettering
3f9a615dcf man: add man page for the systemd UEFI stub
Fixes: #17215
2021-09-23 17:24:28 +02:00
Lennart Poettering
3a6249127e boot: add get_os_indications_supported() helper
We inquire the EFI var for this at two places, let's add a helper that
queries it and gracefully handles it if we can't get it, by returning a
zero mask, i.e. no features supported.
2021-09-23 17:24:28 +02:00
Lennart Poettering
0d43ce5266 stub: various modernizations to linux.c
Let's make some stuff const. Most importanly call AllocatePages() with
a pointer to an EFI_PHYSICAL_ADDRESS instead of a pointer to a
pointer. On 64bit this makes no difference, but on i386 this is simply
not correct, since EFI_PHYSICAL_ADDRESS is 64bit there, even though
pointers are 32bit.
2021-09-23 17:24:28 +02:00
Lennart Poettering
a0a644be70 boot: add helper for converting EFI_PHYSICAL_ADDRESS to a pointer
This isn't trivial when trying to be compatible with 32bit archs, hence
add a set of helper macro-like functions that make the conversion safe.
2021-09-23 17:24:28 +02:00
Lennart Poettering
61b6249552 boot: move TPM conditionalization into measure.h header
Let's move conditionalization of tpm_log_load_options() into the
measure.h to encapsulate the ifdeffery a bit more.
2021-09-23 17:24:10 +02:00
Lennart Poettering
ef6ff81a53 boot: port more code over to get_file_info_harder() 2021-09-23 17:24:10 +02:00
Lennart Poettering
19c896e99c boot: port more code to readdir_harder() 2021-09-23 17:24:10 +02:00
Lennart Poettering
4cbecde937 boot: use _cleanup_freepool_ at more places 2021-09-23 17:24:10 +02:00
Lennart Poettering
77c015820c boot: port more code to use open_directory() helper 2021-09-23 17:24:10 +02:00
Lennart Poettering
2553a5482c boot: automatically load drop-in EFI drivers off the ESP
Fixes: #15617
2021-09-23 17:24:10 +02:00
Lennart Poettering
d72f81be74 boot: split out code that loads the various menu entries into helper call
Just some refactoring, no real code changes.
2021-09-23 17:24:10 +02:00
Lennart Poettering
0be2a06ac7 boot: split out code that sets various EFI vars from main()
Just some refactoring, no actual code changes.
2021-09-23 17:24:10 +02:00
Lennart Poettering
6e161dc860 stub: make splash image payload const 2021-09-23 17:24:10 +02:00
Lennart Poettering
94b81afb08 stub: show splash screen earlier
let's move showing of the splash screen to the earliest place we know
the splash bmp address. After all a splash screen is all about showing
as early as we can. This matters as doing TPM stuff or packing up a
large cpio might take time.

While we are at it, move the conditionalization of the splash screen
into the function instead of doing it ahead of calling it. This should
encapsulate things more nicely.
2021-09-23 17:24:10 +02:00
Lennart Poettering
5a186322a1 stub: split out code that sets the various efi vars into function of its own
Just some refactoring, no code changes beyond the splitting out.
2021-09-23 17:24:09 +02:00
Lennart Poettering
e6e24af507 boot: unify code that measures image options/kernel command line 2021-09-23 17:24:09 +02:00
Lennart Poettering
faacf1807e boot: stop making TPM PCR to measure kernel command line into configurable
Everyone appears to use PCR 8 for this, hence I think it's safe to
hardcode that in systemd too.

It's also documented, like here:

https://www.gnu.org/software/grub/manual/grub/html_node/Measured-Boot.html

or here:

https://github.com/rhboot/shim/blob/main/README.tpm

(And the previous name was a bit confusing, since we don't actually just
measure one thing anymore, but mutliple things into multiple PCRs...)
2021-09-23 17:24:09 +02:00
Lennart Poettering
845707aae2 stub: when booting a kernel foo.efi then pack foo.efi.extra.d/*.{cred,raw} up as synthetic initrd
This adds support for the EFI stub to look for credential files and
sysext files next to the EFI kernel image being loaded, and pack them up
in an initrd cpio image, and pass them to the kernel.

Specifically, for a kernel image foo.efi it looks for
foo.efi.extra.d/*.cred and packs these files up in an initrd, placing it
inside a directory /.extra/credentials/. It then looks for
foo.efi.extra.d/*.raw and pack these files up in an initrd, placing them
inside a directory /.extra/sysexts/. It then concatenates any other
initrd with these two initrds, so they are combined.

Or in other words auxiliary files placed next to the kernel image are
picked up automatically by the EFI stub and be made available in the
initrd in the /.extra/ directory.

What's the usecase for this? This is supposed to be useful in context of
implementing fully trusted initrds, i.e. initrds that are not built
locally on the system and unsigned/unmeasured – as we do things
currently —, but instead are built by the vendor, and measured to TPM.
The idea is that a basic initrd is always linked into the kernel EFI
image anyway. This will already be sufficient for many cases. However,
in some cases it is necessary to parameterize initrds, or to extend the
basic initrds with additional subsystems (e.g. think complex storage, or
passing server info/certificates/… to initrds). The idea is that the
parameterization is done using the "credentials" logic we already have
in systemd, with these credential files (which can optionally be
encrypted+authenticated by TPM2) being placed in the ESP next to the
kernel image. And the initrd extension via the "sysext" logic we already
have in systemd too.

Note that the files read by this code are not verified immediately, they
are copied *as-is* and placed into /.extra/ in the initrd. In a trusted
environment they need to be validated later, but before first use. For
the credentials logic this should be done via the TPM2
encryption/authentication logic. For the sysext stuff the idea is that
this is done via signed images, as implemented by #20691.
2021-09-23 17:24:09 +02:00
Lennart Poettering
80b2f4d92c boot: generalize sorting code
Let's make this generic, so that we can reuse it elsewhere later.
2021-09-23 17:23:45 +02:00
Lennart Poettering
c6dfe36044 boot: add a bunch of new helper calls 2021-09-23 17:23:45 +02:00
Lennart Poettering
88657f7575 boot: add a way to indicate overflow in ALIGN_TO() 2021-09-23 17:10:21 +02:00
Lennart Poettering
3fc0688d42 update TODO 2021-09-23 17:07:25 +02:00
Lennart Poettering
a02c1239cc mkosi: turn off qemu headless mode
We ship the mkosi files to make sure we can test our own code. A good
chunk of our code (and the main reason to use qemu rather than nspawn)
is the EFI code, i.e. in sd-boot and the EFI stub. Hence it's bad idea
to use qemu headless mode, since that means we bypass all that.

Let's hence toggle the defaults here, but keep the line in place, to
make it easy to switch back if someone wants the speed, rather than the
testing.
2021-09-23 17:07:13 +02:00
Anssi Hannula
26d54e1263 bootctl: Fix update not adding EFI entry if Boot IDs are non-consecutive
"bootctl update" tries to add sd-boot to the EFI boot loader list if it
is not already there. To do so, it uses find_slot() which finds the
proper BootXXXX slot ID to use and also returns 1 if an existing sd-boot
entry was found at this ID or 0 if it is a new unused ID. In "update"
case install_variables() only writes the entry in case 0 (no existing
entry).

However, find_slot() erroneously returns 1 if it finds a gap in the Boot
IDs (i.e. when not resorting to max(ids) + 1). This causes
"bootctl update" to not add a missing systemd-boot boot entry if the
existing BootXXXX entry IDs are not consecutive.

Fix that by returning 0 in find_slot() when an empty gap ID is selected
to make it match the behavior when selecting an empty non-gap ID.
2021-09-23 17:05:20 +02:00
Alberto Mardegan
4db9e01f7f docs: clarify order of events in cgroup scope creation 2021-09-23 16:02:03 +01:00
Dan Streetman
cf7c7512f5 userdb: fix if-else to allow NameServiceSwitch lookups
Fixes: #20809. Bug introduced in 8fbb1941f1
2021-09-22 22:34:37 +01:00
Yu Watanabe
469fd57f18 sd-dhcp6-client: ignore IAs whose IAID do not match client's IAID
But do not refuse whole message.

Fixes #20803.
2021-09-22 21:19:54 +01:00
Luca Boccassi
2982084827
Merge pull request #20736 from keszybz/ioprio-simplification
Use a simple kernel-compatible header for ioprio
2021-09-22 15:46:50 +01:00
Luca Boccassi
3a18c0e5f2
Merge pull request #20806 from fbuihuu/test-make-debug-tools-optional
test: make the installation of the debug tools optional in the image
2021-09-22 12:01:59 +01:00
Zbigniew Jędrzejewski-Szmek
5bead76e46 Get rid of ioprio.h and add a minimalistic reimplementation of the api 2021-09-22 12:58:47 +02:00
Zbigniew Jędrzejewski-Szmek
51fe206fb3 Define ioprio_{get,set} the same as other compat syscalls 2021-09-22 12:58:47 +02:00
Zbigniew Jędrzejewski-Szmek
3c9fbb993b variuos: add missing includes 2021-09-22 12:58:46 +02:00
Zbigniew Jędrzejewski-Szmek
465a6f1544
Merge pull request #20767 from bluca/portable_extract_selinux
portable: copy SELinux label when extracting units from images
2021-09-22 12:57:30 +02:00
John Lindgren
750bb04785 Add Logitech USB-PS/2 M-BT96A to hwdb 2021-09-22 11:36:43 +01:00
Luca Boccassi
721d13b19f
Merge pull request #20756 from benzea/benzea/usb-persist
hwdb: Permit unsetting power/persist for USB devices
2021-09-22 10:50:07 +01:00
Yu Watanabe
7df4e57470
Merge pull request #20800 from keszybz/smack-compilatio-fix
smack: move helper function to smack-util.c
2021-09-22 16:56:37 +09:00
Franck Bui
9fbb13acbc test: wc is needed by test/units/testsuite-50.sh 2021-09-22 09:04:52 +02:00
Franck Bui
f7d47cc862 test: make the installation of the debug tools optional in the image 2021-09-22 08:37:34 +02:00
Yu Watanabe
3346eb1800
Merge pull request #20652 from OnkelUlla/fix_systemd.netdev_manpage
Some Fixes for SYSTEMD.NETDEV(5)
2021-09-22 15:34:21 +09:00
Frantisek Sumsal
220261ef94 unit: install the systemd-bless-boot.service only if we have gnu-efi
Follow-up to #20591.
2021-09-22 08:47:59 +09:00
Benjamin Berg
e68220221c hwdb: update fingerprint autosuspend rules
This pulls in a few new devices and adds ID_PERSIST=0.
2021-09-21 20:28:10 +02:00
Benjamin Berg
bd37360a21 hwdb: Permit unsetting power/persist for USB devices
The USB persist feature allows devices that can retain their state when
powered down to work across suspend/resume. This is in particular useful
for USB drives.

However, the persist feature can get in the way for devices that are
unable to retain their state when power is lost. An example of such
stateful devices are fingerprint readers where USB persist should be
disabled to ensure userspace can detect whether the USB device had a
power loss during system suspend.

This will initially be used by the libfprint autosuspend hwdb.

Closes: #20754
2021-09-21 20:28:10 +02:00
Zbigniew Jędrzejewski-Szmek
07b382cc2b meson: ignore -Dsmack-run-label= if -Dsmack=false
Compilation would fail because we could have HAVE_SMACK_RUN_LABEL without
HAVE_SMACK. This doesn't make much sense, so let's just make -Dsmack=false
completely disable smack.

Also, the logic in smack-setup.c seems dubious: '#ifdef SMACK_RUN_LABEL'
would evaluate to true even if -Dsmack-run-label='' is used. I think
this was introduced in the conversion to meson:
8b197c3a8a added

AC_ARG_WITH(smack-run-label,
AS_HELP_STRING([--with-smack-run-label=STRING],
        [run systemd --system with a specific SMACK label]),
        [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run with a smack label])],
        [])

i.e. it really was undefined if not specified. And it was same
still in 72cdb3e783 when configure.ac
was dropped.

So let's use the single conditional HAVE_SMACK_RUN_LABEL everywhere.
2021-09-21 20:13:37 +02:00
Daan De Meyer
7e99216c1d mkosi: Fix CI
\#20629 moved the mkosi configs to mkosi.default.d/ so we were building
for the host distro (Ubuntu) in each CI configuration. To fix it, we
write the distro we want to test to a mkosi.default file and mkosi
will apply the other necessary configs automatically from mkosi.default.d/<distro>

This commit also removes unnecessary CLI options that are already handled
by the config files.
2021-09-21 17:39:00 +01:00
Zbigniew Jędrzejewski-Szmek
ce0458be09 smack: move helper function to smack-util.c
The function was in basic/fileio.c, but it's more appropriate to
keep it out of src/basic.

Fixes compilation with -Dsmack-run-label= set.
2021-09-21 18:31:42 +02:00
Luca Boccassi
71a80dcc0b
Merge pull request #20690 from DaanDeMeyer/oomd-user-services
oom: Support for user services
2021-09-21 15:39:48 +01:00