Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread safety not documented #2926

Open
gotthardp opened this issue Dec 14, 2024 · 1 comment
Open

Thread safety not documented #2926

gotthardp opened this issue Dec 14, 2024 · 1 comment

Comments

@gotthardp
Copy link
Contributor

gotthardp commented Dec 14, 2024

I believe the use of the functions from multiple threads should be better documented.
For example, the statement The purpose and intend of tpm2-tss's contexts is to have 1 context per thread. from #2914 (comment)

Is the same true for the Tcti contexts?

@joholl
Copy link
Collaborator

joholl commented Jan 9, 2025

Good question. I'd say the design goal is being able to have multiple tcti contexts for a given thread. I'm not aware of any showstoppers here (global variables etc.). Let me make clear, however, that this is not the focus of our tests. So I would not bet money on it.

In other words - we should write tests for using multiple tctis in the same thread before documenting this.


I remember the tcti-libtpms had a challenge for multi-threading, but we did our best to make it work. See also this comment. Again, not the focus of our tests.

/*
* libtpms API calls need to be wrapped. We set the current active TCTI module
* for this thread. This is needed because libtpms may call callbacks and these
* need to know which TCTI context they have to operate on.
*
* This macro assumes that int ret is declared. Jumps to fail_label on error. In
* this case, rc contains the respective error code.
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants