]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/arm64/mm/mmu.c
mm/vmalloc: add interfaces to free unmapped page table
[mirror_ubuntu-bionic-kernel.git] / arch / arm64 / mm / mmu.c
index fe68a48c64cbe489f0ccdc11f7901c18fdaf6b5b..f15dc3dfecf81a5e85f74eb04a12e502990ddf5d 100644 (file)
@@ -107,7 +107,7 @@ static bool pgattr_change_is_safe(u64 old, u64 new)
         * The following mapping attributes may be updated in live
         * kernel mappings without the need for break-before-make.
         */
-       static const pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE;
+       static const pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE | PTE_NG;
 
        /* creating or taking down mappings is always safe */
        if (old == 0 || new == 0)
@@ -117,6 +117,10 @@ static bool pgattr_change_is_safe(u64 old, u64 new)
        if ((old | new) & PTE_CONT)
                return false;
 
+       /* Transitioning from Non-Global to Global is unsafe */
+       if (old & ~new & PTE_NG)
+               return false;
+
        return ((old ^ new) & ~mask) == 0;
 }
 
@@ -541,8 +545,16 @@ static int __init map_entry_trampoline(void)
        __create_pgd_mapping(tramp_pg_dir, pa_start, TRAMP_VALIAS, PAGE_SIZE,
                             prot, pgd_pgtable_alloc, 0);
 
-       /* ...as well as the kernel page table */
+       /* Map both the text and data into the kernel page table */
        __set_fixmap(FIX_ENTRY_TRAMP_TEXT, pa_start, prot);
+       if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
+               extern char __entry_tramp_data_start[];
+
+               __set_fixmap(FIX_ENTRY_TRAMP_DATA,
+                            __pa_symbol(__entry_tramp_data_start),
+                            PAGE_KERNEL_RO);
+       }
+
        return 0;
 }
 core_initcall(map_entry_trampoline);
@@ -929,3 +941,13 @@ int pmd_clear_huge(pmd_t *pmd)
        pmd_clear(pmd);
        return 1;
 }
+
+int pud_free_pmd_page(pud_t *pud)
+{
+       return pud_none(*pud);
+}
+
+int pmd_free_pte_page(pmd_t *pmd)
+{
+       return pmd_none(*pmd);
+}