]> xenbits.xensource.com Git - ovmf.git/commitdiff
ArmPkg/ArmMmuLib AARCH64: Add missing ISB after page table update
authorArd Biesheuvel <ardb@kernel.org>
Fri, 19 May 2023 21:44:12 +0000 (23:44 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 23 May 2023 00:43:21 +0000 (00:43 +0000)
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.

Reported-by: Oliver Steffen <osteffen@redhat.com>
Tested-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S

index 887439bc042f0f16c9608f84b25a3c5febdc1b9b..1f0d8057926933d7cbde80364f89ffbb463b68d3 100644 (file)
@@ -65,6 +65,7 @@
   // write updated entry\r
   str   x1, [x0]\r
   dsb   nshst\r
+  isb\r
 \r
 .L2_\@:\r
   .endm\r