resourcemgr: Fix race condition caused by global data / cmdBuffer.

The global buffer holding TPM command buffers from clients is populated
by server threads outside the global lock / critical section. When two
clients send commands at the same time the server thread servicing each
client will be writing to this global buffer at the same time and
possibly overwriting eachother.

This patch solves this problem by making the buffer used by server
threads local to the thread. An alternative approach would be to
increase the scope of the global lock / critical section to include all
accesses to the global buffer. In this specific case though, doing so
would effectively make the resourcemgr single threaded as no server
threads would be able to receive any client data until the lock was
available.

Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
1 file changed
tree: 01f262c4f3b829a13e9d89b3cb0f44865cde81f2
  1. common/
  2. contrib/
  3. doc/
  4. include/
  5. lib/
  6. resourcemgr/
  7. sysapi/
  8. tcti/
  9. test/
  10. .gitattributes
  11. .gitignore
  12. .travis.yml
  13. AUTHORS
  14. bootstrap
  15. CHANGELOG.md
  16. configure.ac
  17. INSTALL
  18. LICENSE
  19. MAINTAINERS
  20. Makefile.am
  21. README.md
README.md

Build Status

TPM (Trusted Platform Module) 2.0 Software Stack (TSS):

This stack consists of the following layers from top to bottom:

  • Feature API (FAPI), see specification 0.12, (published but still in progress and unimplemented)
  • Enhanced System API (ESAPI), (specification in progress and unimplemented)
  • System API (SAPI), see 1.0 specification, (public, 0.97 implementation complete). This layer implements the system layer API level of the TSS 2.0 specification. These functions can be used to access all TPM 2.0 functions as described in Part 3 of the TPM 2.0 specification. The usefulness of this code extends to all users of the TPM, even those not planning to use the upper layers of the TSS.
  • TPM Command Transmission Interface (TCTI), used by SAPI to communicate with next lower layer (either the TAB/RM or TPM 2.0 device driver), see SAPI specification
  • Trusted Access Broker/Resource Manager (TAB/RM), see 0.91 specification, (public, implementation complete). This layer sits between the system API library code and the TPM. It is a daemon that handles all multi-process coordination and manages the TPM's internal resources transparently to applications.

Since the FAPI and ESAPI haven't been implemented yet, this repository only contains the SAPI and layers below it, plus a test application for exercising the SAPI.

The test application, tpmclient, tests many of the commands against the TPM 2.0 simulator. The tpmclient application can be altered and used as a sandbox to test and develop any TPM 2.0 command sequences, and provides an excellent development and learning vehicle.

Build and Installation Instructions:

Run Instructions

Architecture/Block Diagram

Code Layout

Resources

TPM 2.0 specifications can be found at Trusted Computing Group.