linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Kernel 5.0 regression in /dev/tpm0 access
@ 2019-03-09 20:48 Mantas Mikulėnas
  2019-03-09 22:01 ` James Bottomley
  0 siblings, 1 reply; 11+ messages in thread
From: Mantas Mikulėnas @ 2019-03-09 20:48 UTC (permalink / raw)
  To: linux-integrity, Tadeusz Struk, Jarkko Sakkinen

Hello, I'm not entirely sure where I'm supposed to send this –

As of kernel 5.0.0, I'm unable to use the TPM on my laptop (HP
EliteBook 840 G4, with Infineon TPM 2.0) with the current version of
Intel TPM2 tools (tpm2-tss 2.2.0, tpm2-tools 3.1.3). The tools – e.g.
tpm2_pcrlist or tpm2_nvread – sometimes succeed, sometimes are unable
to read anything from /dev/tpm0 at all (immediately report an EOF),
and sometimes are able to read part of the response but stop halfway.

The problem seems to be caused by commit 9488585b21bef0df12 ("tpm: add
support for partial reads"); I've compiled 5.0.0 with that commit
reverted and the tpm2 tools no longer have problems. Investigating
with `strace` shows that the tools frequently get 0 bytes out of a 4k
read:

[good]
write(3, "\200\1\0\0\0\32\0\0\1~\0\0\0\2\0\4\3\0\0\0\0\v\3\0\377\377", 26) = 26
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
read(3, "\200\1\0\0\0012\0\0\0\0\0\0\0h\0\0\0\2\0\4\3\0\0\0\0\v\3\0\377\0\0\0"...,
4096) = 306

[bad]
write(3, "\200\1\0\0\0\32\0\0\1~\0\0\0\2\0\4\3\0\0\0\0\v\3\0\0\377", 26) = 26
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
read(3, "", 4096)                       = 0
write(2, "WARNING:tcti:src/tss2-tcti/tcti-"..., 97) = 97
write(2, "ERROR: ", 7)                  = 7
write(2, "read pcr failed. tpm error 0xa00"..., 34) = 34

(Interestingly, this is very difficult to reproduce under strace, yet
almost guaranteed to happen when not being traced. It almost feels as
if this is a timing issue?)

-- 
Mantas Mikulėnas

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-03-20  9:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 20:48 Kernel 5.0 regression in /dev/tpm0 access Mantas Mikulėnas
2019-03-09 22:01 ` James Bottomley
2019-03-09 22:44   ` James Bottomley
2019-03-11 13:09     ` Jarkko Sakkinen
2019-03-12 22:42       ` Tadeusz Struk
2019-03-12 22:50         ` James Bottomley
2019-03-13 14:00           ` Jarkko Sakkinen
2019-03-13 13:59         ` Jarkko Sakkinen
2019-03-17 13:22           ` Jarkko Sakkinen
2019-03-18 15:50             ` Tadeusz Struk
2019-03-20  9:58               ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).