Skip to content

NvFile assertion check fails after upgrading tpm2-tss to v4.1.3 #540

@krabinowitz1

Description

@krabinowitz1

Hi libtpms maintainers — I realize this behavior originates in tpm2-tss rather than libtpms itself, but I’m hoping to get your guidance since libtpms is the layer being affected and the maintainers of tpm2-tss have not been engaging with recent issues.

We're using libtpms via the tpm2-tss tcti-libtpms API. After upgrading to v4.1.3, our application crashes when it calls the API to open a connection to the simulated TPM. This assertion in libtpms is failing because it expects the NvFile to exist, but our application, which runs inside a Linux Docker container as a non-root user, is lacking necessary permissions to create said file.

When we used v4.0.1 of tpm2-tss, we did not encounter this problem because of the registered callbacks being implemented for tpm_nvram_loaddata and tpm_nvram_storedata. But this commit set these callbacks to NULL, which changes the behavior of libtpms to its use its default implementation, as your docs explain.

It's not exactly clear to me why this change to remove the callbacks was needed. The commit title mentions something about PCR overwrites, but that's as much context as I have on that.

One additional point I wanted to sanity-check relates to documented behavior versus what we’re observing in practice.

The tpm2-tss documentation for tcti-libtpms currently states:

If no state file is passed via conf, all state is held in RAM and discarded when the process dies.

But when using v4.1.3 that doesn’t appear to be true anymore. If no state file is explicitly passed via tpm2-tss configuration, libtpms appears to fall back to its default persistence mechanism, which writes TPM state to a file via its internal implementation.

From an integration standpoint, this is surprising, because it effectively changes the default behavior from ephemeral in-memory state to file-backed persistence, even when the caller does not opt into persistence.

Our use case is intentionally narrow. We only require the library's functionality for MakeCredential and signature verification (VerifySignature), and to the best of our understanding these operations do not depend on persistent TPM state such as PCR allocation, NV indices, or other long-lived configuration.

Because of this, we’d prefer an option to be able to retain the previous behavior — i.e., a true in-RAM-only mode — so that we don’t need to grant filesystem permissions or risk file-update contention in high-traffic environments when it wouldn't provide any tangible benefits for our scenario. If there is no way around it, however, what would be the recommended approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions