Skip to content

Commit

Permalink
boot: stop making TPM PCR to measure kernel command line into configu…
Browse files Browse the repository at this point in the history
…rable

Everyone appears to use PCR 8 for this, hence I think it's safe to
hardcode that in systemd too.

It's also documented, like here:

https://www.gnu.org/software/grub/manual/grub/html_node/Measured-Boot.html

or here:

https://github.com/rhboot/shim/blob/main/README.tpm

(And the previous name was a bit confusing, since we don't actually just
measure one thing anymore, but mutliple things into multiple PCRs...)
  • Loading branch information
poettering committed Sep 23, 2021
1 parent 845707a commit faacf18
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1636,8 +1636,6 @@ if get_option('efi')

have = true
conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)

conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
else
have = false
endif
Expand Down
2 changes: 0 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,6 @@ option('efi-libdir', type : 'string',
description : 'path to the EFI lib directory')
option('efi-includedir', type : 'string', value : '/usr/include/efi',
description : 'path to the EFI header directory')
option('tpm-pcrindex', type : 'integer', value : 8,
description : 'TPM PCR register number to use')
option('sbat-distro', type : 'string',
description : 'SBAT distribution ID, e.g. fedora, or auto for autodetection')
option('sbat-distro-generation', type : 'integer', value : 1,
Expand Down
2 changes: 1 addition & 1 deletion src/boot/efi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ static EFI_STATUS image_start(

#if ENABLE_TPM
/* Try to log any options to the TPM, especially to catch manually edited options */
err = tpm_log_event(SD_TPM_PCR,
err = tpm_log_event(TPM_PCR_INDEX_KERNEL_PARAMETERS,
(EFI_PHYSICAL_ADDRESS) (UINTN) loaded_image->LoadOptions,
loaded_image->LoadOptionsSize, loaded_image->LoadOptions);
if (EFI_ERROR(err))
Expand Down
1 change: 0 additions & 1 deletion src/boot/efi/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ if have_gnu_efi
efi_conf = configuration_data()
efi_conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
efi_conf.set10('ENABLE_TPM', get_option('tpm'))
efi_conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))

foreach ctype : ['color-normal', 'color-entry', 'color-highlight', 'color-edit']
c = get_option('efi-' + ctype).split(',')
Expand Down
2 changes: 1 addition & 1 deletion src/boot/efi/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {

#if ENABLE_TPM
/* Try to log any options to the TPM, especially manually edited options */
err = tpm_log_event(SD_TPM_PCR,
err = tpm_log_event(TPM_PCR_INDEX_KERNEL_PARAMETERS,
(EFI_PHYSICAL_ADDRESS) (UINTN) loaded_image->LoadOptions,
loaded_image->LoadOptionsSize, loaded_image->LoadOptions);
if (EFI_ERROR(err))
Expand Down

2 comments on commit faacf18

@xnox
Copy link
Member

@xnox xnox commented on faacf18 Feb 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

This breaks Ubuntu setups. In Ubuntu, we configure grub with PCR8 whilst we configure sdboot with PCR12. This allows us to seal, compute, and differentiate cmdlines as measured by grub and as measured by sdboot, on the same system.

Could this be reverted please?

Or for example use district from grub pcr by default, i.e. 12 - which i guess will not fly, given it is a breaking change for anybody who only ever used sdboot only without grub.

Simultaneous measurements of cmdline to the same pcr by either grub & sdboot and harder to compute sealing policies for if one wants to support one/another/either.

Regards,

Dimitri.

@mrc0mmand
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

This breaks Ubuntu setups. In Ubuntu, we configure grub with PCR8 whilst we configure sdboot with PCR12. This allows us to seal, compute, and differentiate cmdlines as measured by grub and as measured by sdboot, on the same system.

Could this be reverted please?

Or for example use district from grub pcr by default, i.e. 12 - which i guess will not fly, given it is a breaking change for anybody who only ever used sdboot only without grub.

Simultaneous measurements of cmdline to the same pcr by either grub & sdboot and harder to compute sealing policies for if one wants to support one/another/either.

Regards,

Dimitri.

Hey, could you please open an issue for this? The per-commit comments are easily overlooked.

Please sign in to comment.