diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-03-09 21:52:06 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2017-03-23 13:55:35 +0000 |
commit | 141d1497aae004808ecb156ca2bfb5e0bc460a2e (patch) | |
tree | ddb515a56d0719959a74ec88bca1a2ea917fc725 /arch/arm64/mm/mmu.c | |
parent | eccc1bff1b0d168a136ecd51c6091cf0ba02151b (diff) | |
download | linux-141d1497aae004808ecb156ca2bfb5e0bc460a2e.tar.gz linux-141d1497aae004808ecb156ca2bfb5e0bc460a2e.tar.bz2 linux-141d1497aae004808ecb156ca2bfb5e0bc460a2e.zip |
arm64/mmu: add contiguous bit to sanity bug check
A mapping with the contiguous bit cannot be safely manipulated while
live, regardless of whether the bit changes between the old and new
mapping. So take this into account when deciding whether the change
is safe.
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm/mmu.c')
-rw-r--r-- | arch/arm64/mm/mmu.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index ec23aec6433f..382ebd6ef46f 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -103,7 +103,15 @@ static bool pgattr_change_is_safe(u64 old, u64 new) */ static const pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE; - return old == 0 || new == 0 || ((old ^ new) & ~mask) == 0; + /* creating or taking down mappings is always safe */ + if (old == 0 || new == 0) + return true; + + /* live contiguous mappings may not be manipulated at all */ + if ((old | new) & PTE_CONT) + return false; + + return ((old ^ new) & ~mask) == 0; } static void alloc_init_pte(pmd_t *pmd, unsigned long addr, |