Skip to content

Fix a couple of issues in TPM related code

Stefan Berger qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest10 patches 3 repliesIn review
  2. v210 patches 0 repliesSuperseded
  3. v110 patches 14 repliesSuperseded

Changes in v3 from the cover letter

- 6/10: Remove call to clearing of buffers

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10tpm_util: Pass TPMVersion to function writing fatal error responsebackends/tpm/tpm_emulator.c backends/tpm/tpm_passthrough.c backends/tpm/tpm_util.c +1 more+19 -61 reply
2/10tpm_emulator: Reject TPM responses whose size is too smallbackends/tpm/tpm_emulator.c+2 -20 replies
3/10tpm_emulator: Reject sending commands smaller than the request headerbackends/tpm/tpm_emulator.c+5 -00 replies
4/10hw/tpm: tis: Only read from response buffer if rw_offset < lenhw/tpm/tpm_tis_common.c+4 -20 replies
5/10hw/tpm: tis: Use uint32_t for len to avoid truncating size of commandhw/tpm/tpm_tis_common.c+1 -10 replies
6/10hw/tpm: crb: Do not clear internal buffers when backend is busyhw/tpm/tpm_crb.c+0 -11 reply
7/10hw/tpm: crb: Avoid potential integer underflowhw/tpm/tpm_crb.c+10 -30 replies
8/10hw/tpm: crb: Implement tpm_ppi_uninit and use it in tpm_crb_unrealizehw/tpm/tpm_crb.c hw/tpm/tpm_ppi.c hw/tpm/tpm_ppi.h+23 -01 reply
9/10hw/tpm: crb: Consider response_buffer->len of received responsehw/tpm/tpm_crb.c+3 -10 replies
10/10tests: Add tests with commands with bad lengthtests/qtest/tpm-crb-swtpm-test.c tests/qtest/tpm-tests.c tests/qtest/tpm-tests.h +4 more+152 -00 replies

Reviews trailers per patch

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

PatchMarc-André LureauArun Menon
1/10R-b
2/10R-b
3/10R-b
4/10R-b
5/10R-b
6/10R-b R-b
7/10R-b
8/10R-b
9/10R-b
10/10R-b

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

Read the v3 thread

Cover letter [PATCH v3 00/10] Fix a couple of issues in TPM related code

This series of patches fixes various issues in TPM-related code, such as memory leaks, potential integer underflows, clearing of buffers while they are in use, and the proper handling of sizes of commands or responses.

Regards,
Stefan

v3:
- 6/10: Remove call to clearing of buffers

v2:
- Address issues pointed out by Marc-André

Stefan Berger (10):
tpm_util: Pass TPMVersion to function writing fatal error response
tpm_emulator: Reject TPM responses whose size is too small
tpm_emulator: Reject sending commands smaller than the request header hw/tpm: tis: Only read from response buffer if rw_offset < len hw/tpm: tis: Use uint32_t for len to avoid truncating size of command hw/tpm: crb: Do not clear internal buffers when backend is busy hw/tpm: crb: Avoid potential integer underflow
hw/tpm: crb: Implement tpm_ppi_uninit and use it in tpm_crb_unrealize hw/tpm: crb: Consider response_buffer->len of received response
tests: Add tests with commands with bad length

 backends/tpm/tpm_emulator.c             | 12 ++++--
 backends/tpm/tpm_passthrough.c          |  2 +-
 backends/tpm/tpm_util.c                 | 17 ++++++--
 hw/tpm/tpm_crb.c                        | 21 +++++++---
 hw/tpm/tpm_ppi.c                        | 10 +++++
 hw/tpm/tpm_ppi.h                        | 10 +++++
 hw/tpm/tpm_tis_common.c                 |  8 ++--
 include/system/tpm_util.h               |  3 +-
 tests/qtest/tpm-crb-swtpm-test.c        | 10 +++++
 tests/qtest/tpm-tests.c                 | 56 +++++++++++++++++++++++++
 tests/qtest/tpm-tests.h                 |  8 ++++
 tests/qtest/tpm-tis-device-swtpm-test.c | 10 +++++
 tests/qtest/tpm-tis-swtpm-test.c        | 10 +++++
 tests/qtest/tpm-util.c                  | 55 ++++++++++++++++++++++++
 tests/qtest/tpm-util.h                  |  3 ++
 15 files changed, 219 insertions(+), 16 deletions(-)
Signature · 1 line
2.55.0