[PATCH 2/2] powerpc: expose secure variables via sysfs
oohall at gmail.com
Wed Jul 24 19:52:28 AEST 2019
On Wed, Jul 24, 2019 at 12:35 AM Nayna <nayna at linux.vnet.ibm.com> wrote:
> On 07/05/2019 02:05 AM, Michael Ellerman wrote:
> > Hi Nayna,
> Hi Michael, Oliver,
> > Nayna Jain <nayna at linux.ibm.com> writes:
> >> As part of PowerNV secure boot support, OS verification keys are stored
> >> and controlled by OPAL as secure variables. These need to be exposed to
> >> the userspace so that sysadmins can perform key management tasks.
> >> This patch adds the support to expose secure variables via a sysfs
> >> interface It reuses the the existing efi defined hooks and backend in
> >> order to maintain the compatibility with the userspace tools.
> > Which tools? Can you include a log demonstrating how they're used, ie.
> > so that I can test the sequence of commands.
> >> Though it reuses a great deal of efi, POWER platforms do not use EFI.
> >> A new config, POWER_SECVAR_SYSFS, is defined to enable this new sysfs
> >> interface.
> > Sorry I haven't been able to keep up with all the discussions, but I
> > thought the consensus was that pretending to be EFI-like was a bad idea,
> > because we don't have actual EFI and we're not implementing an entirely
> > compatible scheme to EFI anyway.
My read is the consensus was that pretending to be EFI is a bad idea
unless we're going to behave like EFI.
> > Greg suggested just putting the variables in sysfs, why does that not
> > work? Matthew mentioned "complex semantics around variable deletion and
> > immutability" but do we have to emulate those semantics on powerpc?
> Sorry for the delay in the response.
> Yes, I agree. The purpose of the v2 version of the patchset was to try
> and quickly address Matthew's concerns. This version of the patchset:
> * is based on Greg's suggestion to use sysfs
As far as I can tell Greg made that suggestion here:
Then walked back on that suggestion after Matthew pointed out that
efivars is separate because of the immutability requirement and the
odd update semantics:
Considering the whole point of this is to present the same user-facing
interface so shouldn't you be dealing with all the problems that
> * is not using any EFI configs
That's true, but...
> * is not exposing secure variables via efivarfs
> * is STILL using some of the existing EFI code, that is used by EFI to
> expose its variables via sysfs, to avoid code duplication.
We avoid some of the potential problems of selecting CONFIG_EFI and we
gain a bunch of other potential problems since you've hacked the
makefiles to build code that's normally CONFIG_EFI only.
> * is using efivar hooks to expose secure variables for tool compatibility
Here's the real problem. For compatibility with the existing userspace
tooling, which expects UEFI, you need to present the same interface
with the same semantics. Trying to not use efivarfs means you've
already lost since you no longer have the same interface. So how is
this an improvement? I think the options here are to either:
1) Come up with a new interface, implement it, and adapt the user
tooling to deal with the new API.
2) Use efivarsfs and fix the based i-cant-believe-its-not-efi variable
backend so it behaves *exactly* like the UEFI get/setVariable APIs.
This means that you need to validate the update certificates at
runtime. I don't think this is a huge strech since you're already
implementing the validator.
1) gives you the flexibility to change the key hierarchy and whatnot,
while 2) means we've got less weird powerpc crap for users to deal
with. I have no strong opinions about which you choose to do, but
don't do this.
More information about the Linuxppc-dev