On Tue, 14 Mar 2023 at 19:13, Leif Lindholm <quic_llind...@quicinc.com> wrote: > > On Mon, Mar 13, 2023 at 18:16:44 +0100, Ard Biesheuvel wrote: > > Currently, the ARM MMU page table logic will break down any block entry > > that overlaps with the region being mapped, even if the block entry in > > question is using the same attributes as the new region. > > > > This means that creating a non-executable mapping inside a region that > > is already mapped non-executable at a coarser granularity may trigger a > > call to AllocatePages (), which may recurse back into the page table > > code to update the attributes on the newly allocated page tables. > > > > Let's avoid this, by preserving the block entry if it already covers the > > region being mapped with the correct attributes. > > So if a later mapping is made inside the same block with conflicting > attributes? That triggers the break down at that point and because the > existing mapping did not conflict, it'll all flush out? >
Indeed. The case here is simply, e.g., mapping a single page XP that is already covered by a 2 MB XP block: without this patch, we break down that 2 MB block into page mappings that all have the same attributes. If the 4k page being remapped is being allocated for a page table, we may end up with unbounded recursion. If the attributes are actually different, the split still happens. But otherwise, the block mapping is retained. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#101173): https://edk2.groups.io/g/devel/message/101173 Mute This Topic: https://groups.io/mt/97585995/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-