On Fri, Jan 28, 2022 at 6:46 AM Sumit Garg sumit.garg@linaro.org wrote:
On Thu, 27 Jan 2022 at 19:59, Jens Wiklander jens.wiklander@linaro.org wrote:
Adds a driver private tee_context by moving the tee_context in struct optee_notif to struct optee. This tee_context was previously used when doing internal calls to secure world to deliver notification.
The new driver internal tee_context is now also when allocating driver private shared memory. This decouples the shared memory object from its original tee_context. This is needed when the life time of such a memory allocation outlives the client tee_context.
This patch fixes the problem described below:
The addition of a shutdown hook by commit f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot") introduced a kernel shutdown regression that can be triggered after running the OP-TEE xtest suites.
Once the shutdown hook is called it is not possible to communicate any more with the supplicant process because the system is not scheduling task any longer. Thus if the optee driver shutdown path receives a supplicant RPC request from the OP-TEE we will deadlock the kernel's shutdown.
Fixes: f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot") Fixes: 217e0250cccb ("tee: use reference counting for tee_context") Reported-by: Lars Persson larper@axis.com Cc: stable@vger.kernel.org Signed-off-by: Jens Wiklander jens.wiklander@linaro.org
This patch is from "optee: add driver private tee_context" and "optee: use driver internal tee_contex for some rpc" in [1] combined into one patch for easier tracking. It turned out that those two patches fixes reported problem so I'm breaking out this from the patchset in order to target it for the v5.17.
[1] https://lore.kernel.org/lkml/20220125162938.838382-1-jens.wiklander@linaro.o...
drivers/tee/optee/core.c | 1 + drivers/tee/optee/ffa_abi.c | 77 +++++++++++++++++-------------- drivers/tee/optee/optee_private.h | 5 +- drivers/tee/optee/smc_abi.c | 48 +++++++------------ 4 files changed, 64 insertions(+), 67 deletions(-)
Reviewed-by: Sumit Garg sumit.garg@linaro.org
Thanks, I'm picking this up now.
/Jens