Skip to content

vtpmmgr: Some fixes - still incomplete

Jason Andryuk xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 17 repliesIn review
  2. v19 patches 20 repliesSuperseded

Changes in v2 from the cover letter

Added R-by & Ack-by to 1-3,5-8
Updated #4 to use srk_handle=
Updated #7 commit message
Updated #9 per Samuel
Added #10-13

[1] https://lore.kernel.org/xen-devel/[email protected]/
[2] https://lore.kernel.org/xen-devel/[email protected]/
[3] https://lore.kernel.org/xen-devel/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13docs: Warn about incomplete vtpmmgr TPM 2.0 supportdocs/man/xen-vtpmmgr.7.pod+11 -00 replies
2/13vtpmmgr: Print error code to aid debuggingstubdom/vtpmmgr/tpm.c stubdom/vtpmmgr/tpm2.c+2 -20 replies
3/13stubom: newlib: Enable C99 formats for %zstubdom/Makefile+1 -10 replies
4/13vtpmmgr: Allow specifying srk_handle for TPM2docs/man/xen-vtpmmgr.7.pod stubdom/vtpmmgr/init.c+17 -12 replies
5/13vtpmmgr: Move vtpmmgr_shutdownstubdom/vtpmmgr/init.c+14 -141 reply
6/13vtpmmgr: Flush transient keys on shutdownstubdom/vtpmmgr/init.c+8 -01 reply
7/13vtpmmgr: Flush all transient keysstubdom/vtpmmgr/init.c+1 -11 reply
8/13vtpmmgr: Shutdown more gracefullystubdom/vtpmmgr/vtpmmgr.c+11 -12 replies
9/13vtpmmgr: Support GetRandom passthrough on TPM 2.0stubdom/vtpmmgr/marshal.h stubdom/vtpmmgr/vtpm_cmd_handler.c+75 -12 replies
10/13vtpmmgr: Remove bogus cast from TPM2_GetRandomstubdom/vtpmmgr/tpm2.c+10 -32 replies
11/13vtpmmgr: Fix owner_auth & srk_auth parsingstubdom/vtpmmgr/init.c+4 -42 replies
12/13vtpmmgr: Check req_len before unpacking commandstubdom/vtpmmgr/vtpm_cmd_handler.c+6 -02 replies
13/13vtpm: Correct timeout units and command durationstubdom/Makefile stubdom/vtpm-command-duration.patch stubdom/vtpm-microsecond-duration.patch+106 -02 replies

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchSamuel ThibaultAndrew CooperDaniel P. Smith
1/13A-b
2/13R-b
3/13R-b
4/13R-b R-b
5/13R-b R-b
6/13R-b R-b
7/13R-b R-b
8/13R-b R-b
9/13R-b
10/13R-b R-b
11/13R-b R-b
12/13R-b R-b
13/13R-b R-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 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/13] vtpmmgr: Some fixes - still incomplete

vtpmmgr TPM 2.0 support is incomplete. There is no code to save the tpm2 keys generated by the vtpmmgr, so it's impossible to restore vtpm state with tpm2. The vtpmmgr also issues TPM 1.2 commands to the TPM 2.0 hardware which naturally fails. Dag reported this [1][2], and I independently re-discovered it.

I have not fixed the above issues. These are some fixes I made while investigating tpm2 support. At a minimum, "docs: Warn about incomplete vtpmmgr TPM 2.0 support" should be applied to warn others.

This is useful for debugging:
vtpmmgr: Print error code to aid debugging

This fixes vtpmmgr output (also noted by Dag [3]):
stubom: newlib: Enable C99 formats for %z

This gives more flexibility if you are already using the TPM2 hardware:
vtpmmgr: Allow specifying srk_handle for TPM2

These are some changes to unload keys from the TPM hardware (so they are not still loaded for anything that runs afterwards):
vtpmmgr: Move vtpmmgr_shutdown
vtpmmgr: Flush transient keys on shutdown
vtpmmgr: Flush all transient keys
vtpmmgr: Shutdown more gracefully

This lets vtpms initialize their random pools:
vtpmmgr: Support GetRandom passthrough on TPM 2.0

New in v2:
TPM2_GetRandom fix per Samuel:
vtpmmgr: Remove bogus cast from TPM2_GetRandom

Change ":" to "=":
vtpmmgr: Fix owner_auth & srk_auth parsing

Follow on from comments from Samuel
vtpmmgr: Check req_len before unpacking command

Fix for vtpm emulator to work with Linux 5.4
vtpm: Correct timeout units and command duration

Changes in v2:
Added R-by & Ack-by to 1-3,5-8
Updated #4 to use srk_handle=
Updated #7 commit message
Updated #9 per Samuel
Added #10-13

[1] https://lore.kernel.org/xen-devel/[email protected]/
[2] https://lore.kernel.org/xen-devel/[email protected]/
[3] https://lore.kernel.org/xen-devel/[email protected]/

Jason Andryuk (13):
docs: Warn about incomplete vtpmmgr TPM 2.0 support
vtpmmgr: Print error code to aid debugging
stubom: newlib: Enable C99 formats for %z
vtpmmgr: Allow specifying srk_handle for TPM2
vtpmmgr: Move vtpmmgr_shutdown
vtpmmgr: Flush transient keys on shutdown
vtpmmgr: Flush all transient keys
vtpmmgr: Shutdown more gracefully
vtpmmgr: Support GetRandom passthrough on TPM 2.0
vtpmmgr: Remove bogus cast from TPM2_GetRandom
vtpmmgr: Fix owner_auth & srk_auth parsing
vtpmmgr: Check req_len before unpacking command
vtpm: Correct timeout units and command duration

 docs/man/xen-vtpmmgr.7.pod              | 18 +++++++
 stubdom/Makefile                        |  4 +-
 stubdom/vtpm-command-duration.patch     | 52 +++++++++++++++++++
 stubdom/vtpm-microsecond-duration.patch | 52 +++++++++++++++++++
 stubdom/vtpmmgr/init.c                  | 57 +++++++++++++--------
 stubdom/vtpmmgr/marshal.h               | 15 ++++++
 stubdom/vtpmmgr/tpm.c                   |  2 +-
 stubdom/vtpmmgr/tpm2.c                  | 15 ++++--
 stubdom/vtpmmgr/vtpm_cmd_handler.c      | 67 ++++++++++++++++++++++++-
 stubdom/vtpmmgr/vtpmmgr.c               | 12 ++++-
 10 files changed, 266 insertions(+), 28 deletions(-)
 create mode 100644 stubdom/vtpm-command-duration.patch
 create mode 100644 stubdom/vtpm-microsecond-duration.patch
Signature · 1 line
2.30.2