Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3418307pxj; Tue, 15 Jun 2021 00:01:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgQfF1EbaHXZkXm9djI/EZtPlZZyjpVG1Z98iAe/d3GmEDyWYiz0fyHcvse+pLPczOWJMG X-Received: by 2002:a92:c546:: with SMTP id a6mr15627136ilj.39.1623740503237; Tue, 15 Jun 2021 00:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623740503; cv=none; d=google.com; s=arc-20160816; b=Rd+4B1QUwlSSPhDk32SEKA2A7PSScARhlhEfoQnnECnKuc91pghmjzimcpgBgMMe7x d2Is38z4GKnhudZteCMEZ7KutdM0Oyh+HC5PN/32wm07OfX55SpVRjFO4RIwTSFtKQ4C IX2IkG9fpbso6JPaYxReTmJtcAUNFphctkQt+cY2KE7QYYaIWpZAJfd7ZFgk/sJ8y5gd bf5iX7vWGs2S1bWlVdaG52wMPuBZ7FZWBR9Bt2I1s+1yQDhPXVYD7x1TenDIjs7a0Z78 upDw+REcV9aP3il10FqINBhkvGm390QNQHwFmxt7HDn3OQc1xP8v3cLU6JCCYuj3dGUv gxPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=uxV9YrfPTMckE68tXN+z29g+tg5T03Yl2qalXJXkNkc=; b=NO456/8d+beobbuydEcDp4/2nJk2k9p5H/o3jfXD7UTG/c4fnSd8SWj/hs+bosR6qC de1PR3eOeSgYxYQT8y28rIvJDe/EvFFOW80TVK//+wt++TVJdNO57xicZDDhuXEowN9L OJdMXaoaqEGOs1eitFalNLxLnh3QWKHN7lTXDvxhbL1D6s3v96mSlWkBWy48bCb85fob MJcxg4UPMC6Y+8sd4wP0ispShKDKpkxOEQR2wIrrsOq6QvLjBWFcRxQfQe4WnhY09QHl HP7Bp9EhqsnHghaPlF1kzbtCygDXgUrc7p3TAsPVHKsrgWGgqRT0g/doZMAKTEqQt6F7 PKAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r1wXG2g3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si18235089iol.68.2021.06.15.00.01.31; Tue, 15 Jun 2021 00:01:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r1wXG2g3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229613AbhFOHCy (ORCPT + 99 others); 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-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