Skip to content

pSeries dynamic secure boot secvar interface + platform keyring loading

Andrew Donnellan linux-integrity linuxppc-dev lkml 4 versions – Applied

Status from this message: Applied to powerpc/next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest26 patches 15 repliesApplied
  2. v525 patches 23 repliesSuperseded
  3. v424 patches 27 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v324 patches11 repliesSuperseded

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/26powerpc/pseries: Fix handling of PLPKS object flushing timeoutarch/powerpc/platforms/pseries/plpks.c+8 -30 replies
2/26powerpc/pseries: Fix alignment of PLPKS structures and buffersarch/powerpc/platforms/pseries/plpks.c+7 -30 replies
3/26powerpc/secvar: Fix incorrect return in secvar_sysfs_load()arch/powerpc/kernel/secvar-sysfs.c+4 -20 replies
4/26powerpc/secvar: Use u64 in secvar_operationsarch/powerpc/include/asm/secvar.h arch/powerpc/kernel/secvar-sysfs.c arch/powerpc/platforms/powernv/opal-secvar.c +1 more+12 -180 replies
5/26powerpc/secvar: Warn and error if multiple secvar ops are setarch/powerpc/include/asm/secvar.h arch/powerpc/kernel/secvar-ops.c arch/powerpc/platforms/powernv/opal-secvar.c+11 -71 reply
6/26powerpc/secvar: Use sysfs_emit() instead of sprintf()arch/powerpc/kernel/secvar-sysfs.c+2 -20 replies
7/26powerpc/secvar: Handle format string in the consumerarch/powerpc/include/asm/secvar.h arch/powerpc/kernel/secvar-sysfs.c arch/powerpc/platforms/powernv/opal-secvar.c+35 -180 replies
8/26powerpc/secvar: Handle max object size in the consumerarch/powerpc/include/asm/secvar.h arch/powerpc/kernel/secvar-sysfs.c arch/powerpc/platforms/powernv/opal-secvar.c+26 -140 replies
9/26powerpc/secvar: Clean up init error messagesarch/powerpc/kernel/secvar-sysfs.c+3 -30 replies
10/26powerpc/secvar: Extend sysfs to include config varsarch/powerpc/include/asm/secvar.h arch/powerpc/kernel/secvar-sysfs.c+30 -50 replies
11/26powerpc/secvar: Allow backend to populate static list of variable namesarch/powerpc/include/asm/secvar.h arch/powerpc/kernel/secvar-sysfs.c+52 -210 replies
12/26powerpc/secvar: Warn when PAGE_SIZE is smaller than max object sizearch/powerpc/kernel/secvar-sysfs.c+9 -00 replies
13/26powerpc/secvar: Don't print error on ENOENT when reading variablesarch/powerpc/kernel/secvar-sysfs.c+4 -30 replies
14/26powerpc/pseries: Move plpks.h to include directoryarch/powerpc/include/asm/plpks.h arch/powerpc/platforms/pseries/plpks.c+8 -50 replies
15/26powerpc/pseries: Move PLPKS constants to header filearch/powerpc/include/asm/plpks.h arch/powerpc/platforms/pseries/plpks.c+53 -400 replies
16/26powerpc/pseries: Expose PLPKS config values, support additional fieldsarch/powerpc/include/asm/plpks.h arch/powerpc/platforms/pseries/plpks.c+195 -120 replies
17/26powerpc/pseries: Implement signed update for PLPKS objectsarch/powerpc/include/asm/hvcall.h arch/powerpc/include/asm/plpks.h arch/powerpc/platforms/pseries/plpks.c+75 -50 replies
18/26powerpc/pseries: Log hcall return codes for PLPKS debugarch/powerpc/platforms/pseries/plpks.c+2 -00 replies
19/26powerpc/pseries: Make caller pass buffer to plpks_read_var()arch/powerpc/include/asm/plpks.h arch/powerpc/platforms/pseries/plpks.c+16 -70 replies
20/26powerpc/pseries: Turn PSERIES_PLPKS into a hidden optionarch/powerpc/Kconfig arch/powerpc/platforms/pseries/Kconfig+10 -100 replies
21/26powerpc/pseries: Clarify warning when PLPKS password already setarch/powerpc/platforms/pseries/plpks.c+1 -12 replies
22/26powerpc/pseries: Add helper to get PLPKS password lengtharch/powerpc/include/asm/plpks.h arch/powerpc/platforms/pseries/plpks.c+10 -00 replies
23/26powerpc/pseries: Pass PLPKS password on kexecarch/powerpc/include/asm/plpks.h arch/powerpc/kernel/prom.c arch/powerpc/kexec/file_load_64.c +1 more+92 -51 reply
24/26powerpc/pseries: Implement secvars for dynamic secure bootDocumentation/ABI/testing/sysfs-secvar arch/powerpc/platforms/pseries/Makefile arch/powerpc/platforms/pseries/plpks-secvar.c+294 -310 replies
25/26integrity/powerpc: Improve error handling & reporting when loading certssecurity/integrity/platform_certs/load_powerpc.c+20 -60 replies
26/26integrity/powerpc: Support loading keys from PLPKSsecurity/integrity/platform_certs/load_powerpc.c+10 -70 replies

Reviews trailers per patch

25 of 26 patches have a Reviewed-by or Acked-by.

PatchStefan BergerRussell CurreyAndrew DonnellanMimi Zohar
1/26T-b R-b
2/26R-b
3/26R-b
4/26R-b R-b
5/26R-b
6/26R-b
7/26R-b
8/26R-b
9/26R-b
10/26R-b
11/26R-b
12/26R-b
13/26R-b
14/26R-b
15/26R-b
16/26R-b
17/26R-b
18/26R-b
19/26R-b
20/26R-b
21/26R-b
22/26R-b
23/26R-b
24/26
25/26R-b
26/26R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v6 thread

Cover letter [PATCH v6 00/26] pSeries dynamic secure boot secvar interface + platform keyring loading

This series exposes an interface to userspace for reading and writing secure variables contained within the PowerVM LPAR Platform KeyStore (PLPKS) for the purpose of configuring dynamic secure boot, and adds the glue required to load keys from the PLPKS into the platform keyring.

This series builds on past work by Nayna Jain[0] in exposing PLPKS variables to userspace. Rather than being a generic interface for interacting with the keystore, however, we use the existing powerpc secvar infrastructure to only expose objects in the keystore used for dynamic secure boot. This has the benefit of leveraging an existing interface and making the implementation relatively minimal.

This series integrates a previous series to fix some bugs in PLPKS and implement support for signed updates[1], and a cleanup patch from Michael Ellerman[2].

There are a few relevant details to note about the implementation:

* New additions to the secvar API: format(), max_size(), config_attrs, var_names

* New optional sysfs directory "config/" for arbitrary ASCII variables

* Some OPAL-specific code has been relocated from secvar-sysfs.c to powernv platform code. Would appreciate any powernv testing!

* Variable names are fixed and only those used for secure boot are exposed. This is not a generic PLPKS interface, but also doesn't preclude one being added in future.

With this series, both powernv and pseries platforms support dynamic secure boot through the same interface.

Many thanks to Nayna Jain, Ben Gray, Sudhakar Kuppusamy, Shubham Pandey, Mimi Zohar, George Wilson and the others at IBM who have helped us with developing this series, and to everyone who has provided review comments and feedback.

[0]: https://lore.kernel.org/linuxppc-dev/[email protected]/
[1]: https://lore.kernel.org/linuxppc-dev/[email protected]/
[2]: https://lore.kernel.org/linuxppc-dev/[email protected]/

v1: https://lore.kernel.org/linuxppc-dev/[email protected]/
v2: https://lore.kernel.org/linuxppc-dev/[email protected]/
v3: https://lore.kernel.org/linuxppc-dev/[email protected]/
v4: https://lore.kernel.org/linuxppc-dev/[email protected]/
v5: https://lore.kernel.org/linuxppc-dev/[email protected]/

=================

Changes in v6:

Minor code style + commit message fixes (stefanb)

Get rid of an unneeded kzalloc (npiggin)

Don't allocate extra space in the FDT on kexec (ruscur)

Clarify the warning message in cases where password is already set (ajd)

Changes in v5:

New patch to fix incorrect return value in secvar_sysfs_load() (ruscur)

Better explanation of power of 2 kmalloc rounding (mpe)

Add null component check on signed updates (npiggin)

Don't export plpks_signed_update_var() (npiggin)

Fix all the feedback we got on kexec handling, including removing the password from the FDT (npiggin, mpe)

Enable plpks-secvar.c using CONFIG_PPC_SECURE_BOOT rather than CONFIG_PPC_SECVAR_SYSFS (ajd)

Clarify handling of ibm,secvar-backend vs ibm,edk2-compat-v1 compatible string (zohar)

Lots of miscellaneous improvements (npiggin)

Changes in v4:

Fix the build when CONFIG_PSERIES_PLPKS=n (snowpatch)

Shuffled fixes to the front the series (npiggin)

Pass buffer size in secvar_operations->format() (stefanb, npiggin)

Return an error when set_secvar_ops() fails (npiggin)

Add some extra null checks (stefanb, gjoyce)

Add commit message comment elaborating on PAGE_SIZE issues (joel)

Fix error handling in the kexec code (ruscur)

Fix hvcall.h MAX_HCALL_OPCODE rebasing issue (npiggin)

Changes in v3:

Integrate Andrew's PLPKS bugfixes and enhancements series and Michael Ellerman's u64 cleanup patch into this series (and update the other patches to use u64)

New patches to load keys from the PLPKS into the kernel's platform keyring (ruscur)

New patches to pass PLPKS password to new kernels when kexecing (ruscur)

Improve handling of format strings (ruscur)

Clean up secvar error messages (ajd)

Merge config attributes into secvar_operations (mpe)

Add a new static variable names API rather than (ab)using get_next() (ajd/mpe)

Warning message when PAGE_SIZE is smaller than the max object size (ajd)

Move plpks.h to the include directory, and move a bunch of constants in there with a consistent naming scheme

Refresh PLPKS config values whenever plpks_get_usedspace() is called (ajd)

Extra validation on PLPKS config values (ruscur)

Return maxobjlabelsize to userspace as is without subtracting overhead (ruscur)

Fix error code handling in plpks_confirm_object_flushed() (ruscur)

Pass plpks_var struct to plpks_signed_update_var() by reference (mpe)

Make the data buffer in plpks_read_var() caller-allocated to reduce number of allocations/copies (mpe)

Rework the Kconfig options so that PSERIES_PLPKS is a hidden option, turned on by enabling PPC_SECURE_BOOT, and the PLPKS secvar code is activated by PPC_SECVAR_SYSFS to match powernv (ajd)

Use machine_arch_initcall() rather than device_initcall() so we don't break powernv (mpe)

Improve ABI documentation (mpe)

Return -EIO on most read errors (mpe)

Add "grubdbx" variable (Sudhakar)

Use utf8s_to_utf16s() rather than our own "UCS-2" conversion code (mpe)

Fix SB_VERSION data length (ruscur)

Stop prepending policy data on read (ruscur)

Don't print errors to the kernel log when reading non-existent variables (Sudhakar)

Miscellaneous code style, checkpatch cleanups

Changes in v2:

Remove unnecessary config vars from sysfs and document the others, thanks to review from Greg. If we end up needing to expose more, we can add them later and update the docs.

Use sysfs_emit() instead of sprintf() for all sysfs strings

Change the size of the sysfs binary attributes to include the 8-byte flags header, preventing truncation of large writes.

Andrew Donnellan (9):
powerpc/pseries: Fix handling of PLPKS object flushing timeout powerpc/pseries: Fix alignment of PLPKS structures and buffers powerpc/secvar: Clean up init error messages powerpc/secvar: Allow backend to populate static list of variable
names
powerpc/secvar: Warn when PAGE_SIZE is smaller than max object size powerpc/secvar: Don't print error on ENOENT when reading variables powerpc/pseries: Make caller pass buffer to plpks_read_var() powerpc/pseries: Turn PSERIES_PLPKS into a hidden option powerpc/pseries: Clarify warning when PLPKS password already set

Michael Ellerman (1):
powerpc/secvar: Use u64 in secvar_operations

Nayna Jain (2):
powerpc/pseries: Expose PLPKS config values, support additional fields powerpc/pseries: Implement signed update for PLPKS objects

Russell Currey (14):
powerpc/secvar: Fix incorrect return in secvar_sysfs_load() powerpc/secvar: Warn and error if multiple secvar ops are set powerpc/secvar: Use sysfs_emit() instead of sprintf() powerpc/secvar: Handle format string in the consumer powerpc/secvar: Handle max object size in the consumer powerpc/secvar: Extend sysfs to include config vars powerpc/pseries: Move plpks.h to include directory powerpc/pseries: Move PLPKS constants to header file powerpc/pseries: Log hcall return codes for PLPKS debug powerpc/pseries: Add helper to get PLPKS password length powerpc/pseries: Pass PLPKS password on kexec powerpc/pseries: Implement secvars for dynamic secure boot integrity/powerpc: Improve error handling & reporting when loading
certs
integrity/powerpc: Support loading keys from PLPKS

 Documentation/ABI/testing/sysfs-secvar        |  75 +++-
 arch/powerpc/Kconfig                          |   1 +
 arch/powerpc/include/asm/hvcall.h             |   1 +
 arch/powerpc/include/asm/plpks.h              | 195 +++++++++
 arch/powerpc/include/asm/secvar.h             |  21 +-
 arch/powerpc/kernel/prom.c                    |   4 +
 arch/powerpc/kernel/secvar-ops.c              |  10 +-
 arch/powerpc/kernel/secvar-sysfs.c            | 178 ++++----
 arch/powerpc/kexec/file_load_64.c             |  18 +-
 arch/powerpc/platforms/powernv/opal-secvar.c  |  60 ++-
 arch/powerpc/platforms/pseries/Kconfig        |  19 +-
 arch/powerpc/platforms/pseries/Makefile       |   4 +-
 arch/powerpc/platforms/pseries/plpks-secvar.c | 218 ++++++++++
 arch/powerpc/platforms/pseries/plpks.c        | 381 +++++++++++++++---
 arch/powerpc/platforms/pseries/plpks.h        |  71 ----
 .../integrity/platform_certs/load_powerpc.c   |  47 ++-
 16 files changed, 1046 insertions(+), 257 deletions(-)
 create mode 100644 arch/powerpc/include/asm/plpks.h
 create mode 100644 arch/powerpc/platforms/pseries/plpks-secvar.c
 delete mode 100644 arch/powerpc/platforms/pseries/plpks.h
Signature · 1 line
2.39.1