]> git.proxmox.com Git - swtpm.git/commit
swtpm: cuse: Restrict opening CUSE device to one openable file descriptor
authorStefan Berger <stefanb@linux.ibm.com>
Tue, 9 Aug 2022 18:40:49 +0000 (14:40 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Tue, 9 Aug 2022 22:27:07 +0000 (18:27 -0400)
commitbcf1fa951c06519ae498e1949f029309579a51c1
tree62d3ad6171cf08d52aafdf4eab92e81a8cec8ec8
parentb255d07010a8a7c585ba40d0e4be163485badc69
swtpm: cuse: Restrict opening CUSE device to one openable file descriptor

Restrict the opening of the CUSE device to one single file descriptor. We
can modify the CUSE TPM in this way since the kernel's /dev/tpm0 cannot be
opened multiple times, either, and the CUSE TPM should behave in the same
way.

Adjust test the partial reads case to only open CUSE device file once by
using a python program. Close the open file descriptor 100 before using
swtpm_ioctl to avoid failures.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/swtpm/cuse_tpm.c
tests/test_tpm2_partial_reads