From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.17484.1684745845457686987 for ; Mon, 22 May 2023 01:57:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Qp9QLmOD; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1ECF61EFB for ; Mon, 22 May 2023 08:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55DD9C4339B for ; Mon, 22 May 2023 08:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684745844; bh=9sDGIsQ9V5+GjWHCnOLsE0btImyBM57xoVfOc+5irrI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Qp9QLmODYUKNy6wU72+ZVGSijM+9LRlhyAUNfHCcxJrcmGxEf2fJK7NZKQytK2AMo HLTJ+LgiK/yjuR0h+sOxFIs+re5v7JVYlJJQLHKuFK9SGfF/CqBKX/FDRwPqUf9UnB +m4r6CCvFww7tEjrPibZbczyUyUROmkglV3nMD/9HiWl/qj3XeSqAxCDQc2AdfAJcJ wF8ilXnzzWBdNsSBs/fnE3c8BTmcQop35rTp9q25JxgGwN2zGyaf8xJSrSVZyS5cDs 90N+TN5UTobuDXxEpxdHBzLwmPjlylX6UYFh9ZAPgTPD6BIjo+JF+S+bc/WUjtdQfM kAt5jMCN9FYag== Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-4f3a166f8e9so4112772e87.0 for ; Mon, 22 May 2023 01:57:24 -0700 (PDT) X-Gm-Message-State: AC+VfDzAUc7LIk6mViwQqAIobnZsJ1+xjnwwB3ZcAoKbmLHEB4Xw/nFn /u3TaauuttZknUdF60Eq5lvkwVX9QfcGSG7C2DQ= X-Google-Smtp-Source: ACHHUZ7wAk59vIrxXCl7bXyiCgnDwoaz+gPjg62s52yw5mmg6RnPIWP5Zz0W2MjyWH+1avUMQKVDP1820iBE82gL7hA= X-Received: by 2002:a19:7405:0:b0:4f1:2ebf:536f with SMTP id v5-20020a197405000000b004f12ebf536fmr3529962lfe.16.1684745842400; Mon, 22 May 2023 01:57:22 -0700 (PDT) MIME-Version: 1.0 References: <20230520091958.310712-1-ardb@kernel.org> In-Reply-To: <20230520091958.310712-1-ardb@kernel.org> From: "Ard Biesheuvel" Date: Mon, 22 May 2023 10:57:10 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH edk2-stable202305] ArmPkg/ArmMmuLib: Add missing ISB after page table update To: devel@edk2.groups.io, Liming Gao , Leif Lindholm Cc: Michael D Kinney , Oliver Steffen Content-Type: text/plain; charset="UTF-8" Any objections to this? If not, I will push it later today. Thanks. On Sat, 20 May 2023 at 11:20, Ard Biesheuvel wrote: > > The helper that updates live page table entries writes a zero entry, > invalidates the covered address range from the TLBs, and finally writes > the actual entry. This ensures that no TLB conflicts can occur. > > Writing the final entry needs to complete before any translations can be > performed, as otherwise, the zero entry, which describes an invalid > translation, may be observed by the page table walker, resulting in a > translation fault. For this reason, the final write is followed by a DSB > barrier instruction. > > However, this barrier will not stall the pipeline, and instruction > fetches may still hit this invalid translation, as has been observed and > reported by Oliver. To ensure that the new translation is fully active > before returning from this helper, we have to insert an ISB barrier as > well. > > Cc: Liming Gao > Cc: Leif Lindholm > Cc: Michael D Kinney > Reported-by: Oliver Steffen > Tested-by: Oliver Steffen > Signed-off-by: Ard Biesheuvel > --- > ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S > index 887439bc042f0f16..1f0d8057926933d7 100644 > --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S > +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S > @@ -65,6 +65,7 @@ > // write updated entry > str x1, [x0] > dsb nshst > + isb > > .L2_\@: > .endm > -- > 2.39.2 >