Yes it is expected and was true for TPM 1.2 as well. O_NOBLOCK only refers to the "blockiness" of read() and write() operations, not open()s.
I would highly discourage using a patch that does not block open()s. Reason being: It will inherently become racy, when 3 processes want to use 2 transient objects inside the TPM concurrently, since the TPM only has 3 slots total => deadlock. That's why current TSS 2.0 and TSS 1.2 assumed a resource-manager in UserSpace as signle owner of /dev/tpm0 (enforced by single-open-/dev/tpm0). Only alternative would be a RM inside the Kernel. Multi-Open-/dev/tpm can be a local hack, but please never distribute, merge or advocate it. Cheers, Andreas ________________________________________ From: Ken Goldman [[email protected]] Sent: Friday, December 30, 2016 16:53 To: [email protected] Subject: [tpmdd-devel] TPM 2.0 device driver blocking open It appears that an open() to the TPM doesn't block if another process has /dev/tpm0 open. It returns -1, an error. Questions: Is this expected behavior? Was this also true for 1.2? Is there any way to change it. I didn't set O_NOBLOCK. Is there perhaps an ioctl()? Is this something that should be added? ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ tpmdd-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tpmdd-devel ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ tpmdd-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
