]> git.baikalelectronics.ru Git - kernel.git/commit
efi/efivars: Expose RT service availability via efivars abstraction
authorArd Biesheuvel <ardb@kernel.org>
Wed, 8 Jul 2020 10:01:57 +0000 (13:01 +0300)
committerArd Biesheuvel <ardb@kernel.org>
Thu, 9 Jul 2020 07:14:29 +0000 (10:14 +0300)
commit6f3d9aa771ea6ddfb1cbb2ad979ac548095f07d6
tree6e26f83eb19d95e6791b0aab4ef931ef75bb3286
parenta9fbc4f0bf81f80b37f32914dfd9aa6349f59181
efi/efivars: Expose RT service availability via efivars abstraction

Commit

  98d6f4a3e5a4ee ("efi: Use more granular check for availability for variable services")

introduced a check into the efivarfs, efi-pstore and other drivers that
aborts loading of the module if not all three variable runtime services
(GetVariable, SetVariable and GetNextVariable) are supported. However, this
results in efivarfs being unavailable entirely if only SetVariable support
is missing, which is only needed if you want to make any modifications.
Also, efi-pstore and the sysfs EFI variable interface could be backed by
another implementation of the 'efivars' abstraction, in which case it is
completely irrelevant which services are supported by the EFI firmware.

So make the generic 'efivars' abstraction dependent on the availibility of
the GetVariable and GetNextVariable EFI runtime services, and add a helper
'efivar_supports_writes()' to find out whether the currently active efivars
abstraction supports writes (and wire it up to the availability of
SetVariable for the generic one).

Then, use the efivar_supports_writes() helper to decide whether to permit
efivarfs to be mounted read-write, and whether to enable efi-pstore or the
sysfs EFI variable interface altogether.

Fixes: 98d6f4a3e5a4ee ("efi: Use more granular check for availability for variable services")
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/efi-pstore.c
drivers/firmware/efi/efi.c
drivers/firmware/efi/efivars.c
drivers/firmware/efi/vars.c
fs/efivarfs/super.c
include/linux/efi.h