Skip to content

Commit

Permalink
ArmPkg/ArmMmuLib AARCH64: Add missing ISB after page table update
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Oliver Steffen <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
Acked-by: Michael D Kinney <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
  • Loading branch information
ardbiesheuvel authored and mergify[bot] committed May 23, 2023
1 parent c5cf7f6 commit 5ce29ae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
// write updated entry
str x1, [x0]
dsb nshst
isb

.L2_\@:
.endm
Expand Down

0 comments on commit 5ce29ae

Please sign in to comment.