On 23.02.24 02:56, Daniel P. Smith wrote: >> >> Will the TPM TIS CORE ever (have to) request another locality than 0? Maybe the best would >> be to hardcode TPM_ACCESS(0) and get rid of all the locality parameters that are >> passed from one function to another. >> But this is rather code optimization and not really required to fix the reported bug. > > Actually, doing so will break the TPM API. The function > tpm_tis_request_locality() is registered as the locality handler, > int (*request_locality)(struct tpm_chip *chip, int loc), in the tis > instance of struct tpm_class_ops{}. This is the API used by the Secure > Launch series to open Locality2 for the measurements it must record. > I dont understand this. How do you use locality 2 with the current mainline API? Do you adjust the mainline code to use locality 2 instead of 0? This would at least explain how you ran into the underflow issue which from the source code seems to be impossible when using locality 0. But then I wonder why this has not been made clear in this discussion. And then we are talking about fixing a bug that does not even exist in the upstream code. BR, Lino