From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 375F8C48BE8 for ; Tue, 15 Jun 2021 07:00:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 158E96141B for ; Tue, 15 Jun 2021 07:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbhFOHCy (ORCPT ); Tue, 15 Jun 2021 03:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230074AbhFOHCx (ORCPT ); Tue, 15 Jun 2021 03:02:53 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 967D4C061574 for ; Tue, 15 Jun 2021 00:00:48 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id y13-20020a1c4b0d0000b02901c20173e165so1347050wma.0 for ; Tue, 15 Jun 2021 00:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uxV9YrfPTMckE68tXN+z29g+tg5T03Yl2qalXJXkNkc=; b=r1wXG2g3Ij7IpQjP3ce3rAGLFuR/t7fpjpPV3DAsvtb0rvkoXniW0jXUy+NFu5v6an x/aIbngSA6Xg7x/oLGbVkkYcRzXPDK5ehnrd9eM/25bUwjs8Y522tphG2C8cfXnne7cV xYpaXi3tIr/v9hFceGqOcf3cmqMGNeB5OhuSQPWArWyZo7OL3/WlWSn2Okuae5hbnq3V w6HUmWtV46Zm7eZnxeEHgBVovzkqzs24QKVAq3w7iUtVgpsCplS98uWkG/9iCS6Bhwf6 2jTsZeaM3ZocTTRy2Qly0vGDBHFL/M+tjK+eo7swwiNa25dlYsPKVLTybPI84W9C1ghE ZCiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uxV9YrfPTMckE68tXN+z29g+tg5T03Yl2qalXJXkNkc=; b=Tv6/cHy2nI2pJJj34gYuZM+4e3A0n5M2E7s/QeeeCiqTgvMVilfaWX/NMXddp31A8G wg9KFatnQ4thLXvYMMRVRkBM1R8k9z64F9DhHyijsm8tEwIFry4iyKg2lUUexlUi9cXi VOx0KOTk99PkSt9K5McoMJY0BpKsMo/yelrl//3d84XEESo38vjH5qmJkYDvwVmrWZDS w10wHN8TDSvwwBuXmujZgWxQOqgytnXJ73RfNUwq8zBBBFPyCaTZ7CVTK4pz6zyTrB++ 7UGidNHTQcCCtqNJ4rR+ou2LhX63EodOhIgtChKGnnvFHj/pN6ojG59g7oPyLDS1eav6 kaPg== X-Gm-Message-State: AOAM5332+wOTw+MCbNzciCL5cXuAGDIQ8wPVLkK1kKy/uH+OjUh8aKSp +QUfeRAvxK50fSZGqjxAMYXAYyPxZH8N73lXjyHOBg== X-Google-Smtp-Source: ABdhPJywx870VvTJLcC/IUKQvu1pmDshczTbWjQNPyhg5UovPLLVsbpeCyE2WdcabCSWVbVPXbT8GqEPYMFv9vt2Oh4= X-Received: by 2002:a1c:41c5:: with SMTP id o188mr3401371wma.60.1623740447101; Tue, 15 Jun 2021 00:00:47 -0700 (PDT) MIME-Version: 1.0 References: <20210614223317.999867-1-tyhicks@linux.microsoft.com> <20210614223317.999867-5-tyhicks@linux.microsoft.com> In-Reply-To: <20210614223317.999867-5-tyhicks@linux.microsoft.com> From: Jens Wiklander Date: Tue, 15 Jun 2021 09:00:36 +0200 Message-ID: Subject: Re: [PATCH v5 4/8] optee: Clear stale cache entries during initialization To: Tyler Hicks Cc: Allen Pais , Sumit Garg , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Vikas Gupta , Thirupathaiah Annapureddy , Pavel Tatashin , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , OP-TEE TrustedFirmware , linux-integrity , bcm-kernel-feedback-list@broadcom.com, linux-mips@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 15, 2021 at 12:33 AM Tyler Hicks 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@vger.kernel.org > Signed-off-by: Tyler Hicks > --- > 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