arm64: proc: Set PTE_NG for table entries to avoid traversing them twice
authorWill Deacon <will.deacon@arm.com>
Tue, 13 Feb 2018 13:14:09 +0000 (13:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2019 05:19:07 +0000 (07:19 +0200)
commitdf214256a9020628df271824fac6faa2a4378b77
treefe6ad955e779c25ec07907b5e4c53dec5f4f1529
parentfe71230d9a02d267742c893e8acfd870beadc01e
arm64: proc: Set PTE_NG for table entries to avoid traversing them twice

commit 2ce77f6d8a9ae9ce6d80397d88bdceb84a2004cd upstream.

When KASAN is enabled, the swapper page table contains many identical
mappings of the zero page, which can lead to a stall during boot whilst
the G -> nG code continually walks the same page table entries looking
for global mappings.

This patch sets the nG bit (bit 11, which is IGNORED) in table entries
after processing the subtree so we can easily skip them if we see them
a second time.

Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/mm/proc.S