On Sat Feb 24, 2024 at 4:34 AM EET, Lino Sanfilippo wrote: > > > 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. Thanks for bringing this up, now I finally figured out what confuses me in this series. Daniel, I also have troubles understanding why locality_count would ever be greater than zero exactly in the mainline kernel, *without* [1]? [1] https://lore.kernel.org/linux-integrity/20240214221847.2066632-1-ross.philipson@xxxxxxxxxx/ BR, Jarkko