Page MenuHomeFreeBSD

tpm: Bound TPM 1.2 locality ownership
AcceptedPublic

Authored by kbowling on Thu, Aug 27, 11:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Aug 28, 1:19 PM
Unknown Object (File)
Fri, Aug 28, 1:19 PM
Unknown Object (File)
Fri, Aug 28, 12:41 PM
Unknown Object (File)
Fri, Aug 28, 5:42 AM
Unknown Object (File)
Fri, Aug 28, 5:13 AM
Unknown Object (File)
Fri, Aug 28, 12:59 AM
Unknown Object (File)
Fri, Aug 28, 12:39 AM
Subscribers

Details

Summary
A TIS locality must remain active while a command is in flight, but
should be relinquished once the command completes or is abandoned.  The
driver retained locality zero after probe, initialization, and resume,
and several transaction error paths returned without releasing it.
Closing the device after writing a command without reading its response
had the same effect.

Track locality ownership and whether a command is awaiting its response.
Release locality after probe, initialization, and resume; retain it only
across a successful command write and its matching response read.  Abort
and release on errors, replacement commands, close, and detach.

Wait for locality during ISA probe instead of assuming an immediate
grant, release locality acquired by the probe, and stop treating the
command-style TPM_ACCESS register as restorable state.

On a ThinkPad T440p with an STMicro TPM 1.2, the old driver left
TPM_ACCESS at 0xa1 immediately after attach.  The new driver left it at
0x81 after attach, completed PCR reads, and closing with an unread
response.  PCR reads also survived an unload and reload without TPM or
locking diagnostics.

MFC after:      2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kevans added inline comments.
sys/dev/tpm/tpm.c
546

It's really tempting to assert !sc->sc_locality here and the opposite when we relinquish it to enforce some discipline in the driver

This revision is now accepted and ready to land.Fri, Aug 28, 3:38 AM

Add locality acquire assertion. Release side would be trickier since it is used in abort and cleanup.

This revision now requires review to proceed.Fri, Aug 28, 4:02 AM
This revision is now accepted and ready to land.Fri, Aug 28, 4:04 AM