Commit Graph

13 Commits

Author SHA1 Message Date
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Luca Boccassi 7143b95552 efi: define cache functions inside EFI_ENABLE ifdef
../src/shared/efi-loader.c:738:5: error: redefinition of 'efi_loader_get_config_timeout_one_shot'
 int efi_loader_get_config_timeout_one_shot(usec_t *ret) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/shared/efi-loader.c:9:
../src/shared/efi-loader.h:85:19: note: previous definition of 'efi_loader_get_config_timeout_one_shot' was here
 static inline int efi_loader_get_config_timeout_one_shot(usec_t *ret) {
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/efi-loader.c:776:5: error: redefinition of 'efi_loader_update_entry_one_shot_cache'
 int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/shared/efi-loader.c:9:
../src/shared/efi-loader.h:89:19: note: previous definition of 'efi_loader_update_entry_one_shot_cache' was here
 static inline int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat) {
2020-06-26 22:34:22 +02:00
Lennart Poettering af2697e83d logind: also cache LoaderEntryOneShot EFI variable
With this we are now caching all EFI variables that we expose as
property in logind. Thus a client invoking GetAllProperties() should
only trgger a single read of each variable, but never repeated ones.

Obsoletes: #16190
Fixes: #14828
2020-06-26 10:43:42 +02:00
Lennart Poettering e8df4eee65 efi-loader: cache LoaderConfigTimeoutOneShot too
The data from this EFI variable is exposed as dbus property, and gdbus
clients are happy to issue GetAllProperties() as if it was free. Hence
make sure it's actually free and cache LoaderConfigTimeoutOneShot, since
it's easy.
2020-06-26 10:43:42 +02:00
Lennart Poettering c37070c85a efi: cache OsIndications too 2020-05-29 15:41:43 +02:00
Lennart Poettering 9e5230aad9 efi: cache OsIndicationsSupported
As suggested by:

https://github.com/systemd/systemd/issues/14828#issuecomment-634202054
2020-05-29 15:41:06 +02:00
Lennart Poettering 5c25f42322 efi: avoid weirdly double }} by indenting differently 2020-05-29 15:41:03 +02:00
Zbigniew Jędrzejewski-Szmek dde5c821bf shared/efi-loader: remove check that uses absolute tick value
sd-boot uses rdtsc to set those timestamps. There is no guarantee that the tsc
has any particular absolute value.

On my VM:
$ head /sys/firmware/efi/efivars/LoaderTime*
==> /sys/firmware/efi/efivars/LoaderTimeExecUSec-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f <==
4397904074
==> /sys/firmware/efi/efivars/LoaderTimeInitUSec-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f <==
4396386839
==> /sys/firmware/efi/efivars/LoaderTimeMenuUSec-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f <==
4396392521

$ build/test-boot-timestamps
...
LoaderTimeExecUSec=4396386839 too large, refusing.
Failed to read EFI loader data: Input/output error
Assertion 'q >= 0' failed at src/test/test-boot-timestamps.c:84, function main(). Aborting.

(with patch)
$ build/test-boot-timestamps
...
EFI Loader: start=1h 13min 16.386s exit=1h 13min 17.904s duration=1.517s
Firmware began 1h 13min 17.904074s before kernel.
Loader began 1.517235s before kernel.
Firmware began Tue 2020-05-26 11:04:13 CEST.
Loader began Tue 2020-05-26 12:17:30 CEST.
Kernel began Tue 2020-05-26 12:17:31 CEST.
2020-05-27 09:02:53 +02:00
Zbigniew Jędrzejewski-Szmek 0da965037e Add yet another tiny helper to manipulate flags 2020-04-10 16:40:48 +02:00
Arian van Putten c7d26acce6 Disable reading SystemdOptions EFI Var when in SecureBoot mode
In SecureBoot mode this is probably not what you want. As your cmdline
is cryptographically signed like when using Type #2 EFI Unified Kernel
Images (https://systemd.io/BOOT_LOADER_SPECIFICATION/) The user's
intention is then that the cmdline should not be modified.  You want to
make sure that the system starts up as exactly specified in the signed
artifact.
2020-01-16 18:46:56 +01:00
Zbigniew Jędrzejewski-Szmek a97abb30e7 shared/efi-loader: add some debugging statements
Should make it easier to figure out why some operations fail...
2019-12-15 21:06:42 +01:00
Yu Watanabe 8e1e87a5de tree-wide: drop double newline 2019-11-04 00:30:32 +09:00
Zbigniew Jędrzejewski-Szmek 0bb2f0f10e util-lib: split shared/efivars into basic/efivars and shared/efi-loader
I want to use efivars.[ch] in proc-cmdline.c, but most of the efivars stuff is
not needed in basic/. Move the file from shared/ to basic/, but then move back
most of the higher-level functions to the new shared/efi-loader.c file.
2019-09-16 18:08:53 +02:00
Renamed from src/shared/efivars.c (Browse further)