forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: avoid deadlocks caused by single-instance TA
Protect against deadlocks caused by single-instance TAs calling another single-instance TAs directly or indirectly. When a TA is invoked but already is busy with another operation the calling thread is suspended using condvar_wait() until the TA is available again. This is effectively a lock which can cause a deadlock if several such locks are used at the same time but in different order. This patch avoids this problem by only allowing one thread at a time to set a single-instance TA context busy. If the thread with a single-instance TA busy in the call stack tries to set an already busy TA context busy it will return TEE_ERROR_BUSY instead as there is a recursive loop in how the different TAs has invoked each other. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU) Tested-by: Pascal Brand <pascal.brand@linaro.org> (QEMU - full test suite) Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey - full test suite)
- Loading branch information
1 parent
a23dc07
commit 2b07dcb
Showing
3 changed files
with
95 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters