Hi,

In response to your queries:

1) With kernel version 5.0.0-37, I can confirm that the event log
provided by the kernel is inconsistent with the TPM for PCR7 in a VM
that's running OVMF. This is because of the opposite problem - in this
case, the last event is missing from the log exported by the kernel. I'm
not sure why that is yet because it occurs before ExitBootServices() and
should appear in the firmware's main event log.

There is also a mismatch for PCR5, but this one is expected because the
kernel is missing events that occur as a result of or after
ExitBootServices() (in this case, it misses 2 EV_EFI_ACTION events).
This is the problem that will be addressed by this bug report.

2) The stock kernel for Ubuntu 18.04 doesn't export duplicate events in
the event log because it doesn't contain any code to handle the final
events table (to retrieve events that are recorded as a result of or
after ExitBootServices()). The duplicate events occur in the test kernel
with the patches in comment 12 applied because it misses some additional
fixes to de-duplicate events that are recorded both to the firmware's
main event log and the final events table. Events that occur between the
first call to GetEventLog() and ExitBootServices() are recorded by the
firmware to both places.

3) I think this is a GRUB issue. AFAICT, GRUB's linux loader only boots
the kernel via its EFI stub when secure boot is enabled, and I think you
need to boot the kernel with the EFI stub in order for it to retrieve
the event log.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-azure in Ubuntu.
https://bugs.launchpad.net/bugs/1838796

Title:
  TPM event log does not contain events measured after ExitBootServices

Status in linux package in Ubuntu:
  Won't Fix
Status in linux-azure package in Ubuntu:
  In Progress
Status in linux source package in Xenial:
  Won't Fix
Status in linux-azure source package in Xenial:
  In Progress
Status in linux source package in Disco:
  Won't Fix
Status in linux-azure source package in Disco:
  In Progress

Bug description:
  The TPM event log (/sys/kernel/security/tpm0/binary_bios_measurements)
  does not contain any events that are measured by UEFI after the
  kernel's EFI Boot stub calls ExitBootServices().

  This means that PCR values calculated from the event log will not
  match the actual PCR values on the machine for PCR indices into which
  these events are measured.

  There are upstream patches to fix this in the mainline kernel tree: 
https://lore.kernel.org/lkml/20190520205501.177637-1-matthewgarr...@google.com/
  ---
  ProblemType: Bug
  ApportVersion: 2.20.9-0ubuntu7.5
  Architecture: amd64
  AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', 
'/dev/snd/timer'] failed with exit code 1:
  CRDA: Error: command ['iw', 'reg', 'get'] failed with exit code 1: nl80211 
not found.
  CurrentDesktop: ubuntu:GNOME
  DistroRelease: Ubuntu 18.04
  InstallationDate: Installed on 2019-06-20 (43 days ago)
  InstallationMedia: Ubuntu-Server 18.04.2 LTS "Bionic Beaver" - Release amd64 
(20190210)
  IwConfig:
   eth0      no wireless extensions.

   lo        no wireless extensions.
  Lspci:

  Lsusb: Error: command ['lsusb'] failed with exit code 1:
  MachineType: Microsoft Corporation Virtual Machine
  Package: linux (not installed)
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcFB: 0 hyperv_fb
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.18.0-22-generic 
root=UUID=fcb8dc9d-4dd3-490f-9f1c-fa6364770bb0 ro
  ProcVersionSignature: Ubuntu 4.18.0-22.23~18.04.1-generic 4.18.20
  RelatedPackageVersions:
   linux-restricted-modules-4.18.0-22-generic N/A
   linux-backports-modules-4.18.0-22-generic  N/A
   linux-firmware                             1.173.3
  RfKill:

  Tags:  bionic
  Uname: Linux 4.18.0-22-generic x86_64
  UpgradeStatus: No upgrade log present (probably fresh install)
  UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
  _MarkForUpload: True
  dmi.bios.date: 01/30/2019
  dmi.bios.vendor: Microsoft Corporation
  dmi.bios.version: Hyper-V UEFI Release v4.0
  dmi.board.asset.tag: None
  dmi.board.name: Virtual Machine
  dmi.board.vendor: Microsoft Corporation
  dmi.board.version: Hyper-V UEFI Release v4.0
  dmi.chassis.asset.tag: 8486-4870-7514-9524-5524-7794-69
  dmi.chassis.type: 3
  dmi.chassis.vendor: Microsoft Corporation
  dmi.chassis.version: Hyper-V UEFI Release v4.0
  dmi.modalias: 
dmi:bvnMicrosoftCorporation:bvrHyper-VUEFIReleasev4.0:bd01/30/2019:svnMicrosoftCorporation:pnVirtualMachine:pvrHyper-VUEFIReleasev4.0:rvnMicrosoftCorporation:rnVirtualMachine:rvrHyper-VUEFIReleasev4.0:cvnMicrosoftCorporation:ct3:cvrHyper-VUEFIReleasev4.0:
  dmi.product.family: Virtual Machine
  dmi.product.name: Virtual Machine
  dmi.product.sku: None
  dmi.product.version: Hyper-V UEFI Release v4.0
  dmi.sys.vendor: Microsoft Corporation

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1838796/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to