Hello,
I tried to run the kernel TPM selftest from
tools/testing/selftests/tpm2/ on two different VMs, and found that while
on one it works on another it reports a lot of errors.
Inspecting the emolated platfrom configuration it turns out that the
non-working VM had TPM 1.2.
While it is not expected that TPM2 tests would work on TPM 1.2 it would
be nice to report something intelligible to the user when the
requirements are not met.
Perhaps somewhat similar to commit 5627f9cffee7 ("Kernel selftests: Add check
if TPM devices are supported")
Thanks
Michal
Sample output:
jostaberry-2:~/linux/tools/testing/selftests/tpm2/:[0]# ./test_smoke.sh
test_read_partial_overwrite (tpm2_tests.SmokeTest) ... ERROR
test_read_partial_resp (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa89044a8>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
test_seal_with_auth (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa89046d8>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
test_seal_with_policy (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa8904518>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
test_seal_with_too_long_auth (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa89044a8>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
test_send_two_cmds (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa89046d8>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
test_too_short_cmd (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa8904518>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
test_unseal_with_wrong_auth (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa89044a8>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
test_unseal_with_wrong_policy (tpm2_tests.SmokeTest) ... ERROR
Exception ignored in: <bound method Client.__del__ of <tpm2.Client object at
0x7fffa89046d8>>
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 375, in __del__
if self.tpm:
AttributeError: 'Client' object has no attribute 'tpm'
======================================================================
ERROR: test_read_partial_overwrite (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 16, in
setUp
self.root_key = self.client.create_root_key()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 587, in
create_root_key
return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 402, in send_cmd
raise ProtocolError(cc, rc)
tpm2.ProtocolError: TPM_RC_UNKNOWN: cc=0x00000131, rc=0x0000000a
======================================================================
ERROR: test_read_partial_resp (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
======================================================================
ERROR: test_seal_with_auth (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
======================================================================
ERROR: test_seal_with_policy (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
======================================================================
ERROR: test_seal_with_too_long_auth (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
======================================================================
ERROR: test_send_two_cmds (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
======================================================================
ERROR: test_too_short_cmd (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
======================================================================
ERROR: test_unseal_with_wrong_auth (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
======================================================================
ERROR: test_unseal_with_wrong_policy (tpm2_tests.SmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/linux/tools/testing/selftests/tpm2/tpm2_tests.py", line 15, in
setUp
self.client = tpm2.Client()
File "/root/linux/tools/testing/selftests/tpm2/tpm2.py", line 364, in __init__
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
OSError: [Errno 16] Device or resource busy: '/dev/tpm0'
----------------------------------------------------------------------
Ran 9 tests in 0.012s
FAILED (errors=9)