Skip to content

ima: carry the measurement list across kexec

Thiago Jung Bauermann kexec linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v6 Latest10 patches 7 repliesIn review

Changes in v6 from the cover letter

- Rebased on top of "kexec_file_load implementation for PowerPC" patches v9.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10powerpc: ima: Get the kexec buffer passed by the previous kernelarch/Kconfig arch/powerpc/Kconfig arch/powerpc/include/asm/ima.h +4 more+158 -10 replies
2/10ima: on soft reboot, restore the measurement listsecurity/integrity/ima/Makefile security/integrity/ima/ima.h security/integrity/ima/ima_init.c +3 more+248 -03 replies
3/10ima: permit duplicate measurement list entriessecurity/integrity/ima/ima_queue.c+9 -61 reply
4/10ima: maintain memory size needed for serializing the measurement listsecurity/integrity/ima/Kconfig security/integrity/ima/ima.h security/integrity/ima/ima_queue.c+64 -22 replies
5/10powerpc: ima: Send the kexec buffer to the next kernelarch/powerpc/include/asm/ima.h arch/powerpc/include/asm/kexec.h arch/powerpc/kernel/ima_kexec.c +2 more+129 -60 replies
6/10ima: on soft reboot, save the measurement listinclude/linux/ima.h kernel/kexec_file.c security/integrity/ima/ima.h +2 more+135 -10 replies
7/10ima: store the builtin/custom template definitions in a listsecurity/integrity/ima/ima.h security/integrity/ima/ima_main.c security/integrity/ima/ima_template.c+44 -111 reply
8/10ima: support restoring multiple template formatssecurity/integrity/ima/ima_template.c+50 -30 replies
9/10ima: define a canonical binary_runtime_measurements list formatDocumentation/kernel-parameters.txt security/integrity/ima/ima.h security/integrity/ima/ima_fs.c +3 more+67 -130 replies
10/10ima: platform-independent hash valuesecurity/integrity/ima/ima_crypto.c+4 -20 replies

Reviews trailers per patch

3 of 10 patches have a Reviewed-by or Acked-by.

PatchEric W. Biederman
1/10A-b
2/10
3/10
4/10
5/10A-b
6/10A-b
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 00/10] ima: carry the measurement list across kexec

Hello,

This is just a rebase on top of kexec_file_load patches v9 which I just posted. The previous version of this series has some conflicts with it.

Original cover letter:

The TPM PCRs are only reset on a hard reboot. In order to validate a TPM's quote after a soft reboot (eg. kexec -e), the IMA measurement list of the running kernel must be saved and then restored on the subsequent boot, possibly of a different architecture.

The existing securityfs binary_runtime_measurements file conveniently provides a serialized format of the IMA measurement list. This patch set serializes the measurement list in this format and restores it.

Up to now, the binary_runtime_measurements was defined as architecture native format. The assumption being that userspace could and would handle any architecture conversions. With the ability of carrying the measurement list across kexec, possibly from one architecture to a different one, the per boot architecture information is lost and with it the ability of recalculating the template digest hash. To resolve this problem, without breaking the existing ABI, this patch set introduces the boot command line option "ima_canonical_fmt", which is arbitrarily defined as little endian.

The need for this boot command line option will be limited to the existing version 1 format of the binary_runtime_measurements. Subsequent formats will be defined as canonical format (eg. TPM 2.0 support for larger digests).

A simplified method of Thiago Bauermann's "kexec buffer handover" patch series for carrying the IMA measurement list across kexec is included in this patch set. The simplified method requires all file measurements be taken prior to executing the kexec load, as subsequent measurements will not be carried across the kexec and restored.

Changelog v6:
- Rebased on top of "kexec_file_load implementation for PowerPC" patches v9.

Changelog v5:
- Included patches from Thiago Bauermann's "kexec buffer handover" patch series for carrying the IMA measurement list across kexec.
- Added CONFIG_HAVE_IMA_KEXEC
- Renamed functions to variations of ima_kexec_buffer instead of variations of kexec_handover_buffer

Changelog v4:
- Fixed "spinlock bad magic" BUG - reported by Dmitry Vyukov
- Rebased on Thiago Bauermann's v5 patch set
- Removed the skip_checksum initialization

Changelog v3:
- Cleaned up the code for calculating the requested kexec segment size needed for the IMA measurement list, limiting the segment size to half of the totalram_pages.
- Fixed kernel test robot reports as enumerated in the respective patch changelog.

Changelog v2:
- Canonical measurement list support added
- Redefined the ima_kexec_hdr struct to use well defined sizes

Andreas Steffen (1):
ima: platform-independent hash value

Mimi Zohar (7):
ima: on soft reboot, restore the measurement list
ima: permit duplicate measurement list entries
ima: maintain memory size needed for serializing the measurement list
ima: on soft reboot, save the measurement list
ima: store the builtin/custom template definitions in a list
ima: support restoring multiple template formats
ima: define a canonical binary_runtime_measurements list format

Thiago Jung Bauermann (2):
powerpc: ima: Get the kexec buffer passed by the previous kernel
powerpc: ima: Send the kexec buffer to the next kernel

 Documentation/kernel-parameters.txt         |   4 +
 arch/Kconfig                                |   3 +
 arch/powerpc/Kconfig                        |   1 +
 arch/powerpc/include/asm/ima.h              |  29 +++
 arch/powerpc/include/asm/kexec.h            |  15 +-
 arch/powerpc/kernel/Makefile                |   4 +
 arch/powerpc/kernel/ima_kexec.c             | 223 +++++++++++++++++++++
 arch/powerpc/kernel/kexec_elf_64.c          |   2 +-
 arch/powerpc/kernel/machine_kexec_file_64.c |  15 +-
 include/linux/ima.h                         |  12 ++
 kernel/kexec_file.c                         |   4 +
 security/integrity/ima/Kconfig              |  12 ++
 security/integrity/ima/Makefile             |   1 +
 security/integrity/ima/ima.h                |  31 +++
 security/integrity/ima/ima_crypto.c         |   6 +-
 security/integrity/ima/ima_fs.c             |  30 ++-
 security/integrity/ima/ima_init.c           |   2 +
 security/integrity/ima/ima_kexec.c          | 168 ++++++++++++++++
 security/integrity/ima/ima_main.c           |   1 +
 security/integrity/ima/ima_queue.c          |  76 +++++++-
 security/integrity/ima/ima_template.c       | 293 ++++++++++++++++++++++++++--
 security/integrity/ima/ima_template_lib.c   |   7 +-
 22 files changed, 901 insertions(+), 38 deletions(-)
 create mode 100644 arch/powerpc/include/asm/ima.h
 create mode 100644 arch/powerpc/kernel/ima_kexec.c
 create mode 100644 security/integrity/ima/ima_kexec.c
Signature · 1 line
2.7.4