Re: [PATCH v5 4/8] optee: Clear stale cache entries during initialization

From: Jens Wiklander
Date: Tue Jun 15 2021 - 03:00:58 EST


On Tue, Jun 15, 2021 at 12:33 AM Tyler Hicks
<tyhicks@xxxxxxxxxxxxxxxxxxx> wrote:
>
> The shm cache could contain invalid addresses if
> optee_disable_shm_cache() was not called from the .shutdown hook of the
> previous kernel before a kexec. These addresses could be unmapped or
> they could point to mapped but unintended locations in memory.
>
> Clear the shared memory cache, while being careful to not translate the
> addresses returned from OPTEE_SMC_DISABLE_SHM_CACHE, during driver
> initialization. Once all pre-cache shm objects are removed, proceed with
> enabling the cache so that we know that we can handle cached shm objects
> with confidence later in the .shutdown hook.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Tyler Hicks <tyhicks@xxxxxxxxxxxxxxxxxxx>
> ---
> drivers/tee/optee/call.c | 36 ++++++++++++++++++++++++++++---
> drivers/tee/optee/core.c | 9 ++++++++
> drivers/tee/optee/optee_private.h | 1 +
> 3 files changed, 43 insertions(+), 3 deletions(-)

Reviewed-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>