x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled
PATCH 1/1 x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled
The function kernel_map_pages_in_pgd() will not map pages if NX is disabled, which causes a lot of problems booting in EFI mode (efi_map_region() and other functions depend on this). This patch just makes sure that the NX flag doesn't get set in the page tables if NX is disabled, rather than not mapping the pages at all.
---
arch/x86/mm/pageattr.c renamed from arch/x86/mm/pageattr.c.orig +1 -4
@@ -1862,10 +1862,7 @@ int kernel_map_pages_in_pgd(pgd_t *pgd, .flags = 0, }; -if (!(__supported_pte_mask & _PAGE_NX)) - goto out; - -if (!(page_flags & _PAGE_NX)) +if ((!(__supported_pte_mask & _PAGE_NX)) || !(page_flags & _PAGE_NX)) cpa.mask_clr =__pgprot (_PAGE_NX); cpa.mask_set =__pgprot (_PAGE_PRESENT | page_flags);
Borislav Petkov
maintainerQuoted 11 lines · Stuart Hayes
The function
kernel_map_pages_in_pgd()will not map pages if NX is disabled, which causes a lot of problems booting in EFI mode (efi_map_region()and other functions depend on this). This patch just makes sure that the NX flag doesn't get set in the page tables if NX is disabled, rather than not mapping the pages at all.Signed-off-by Stuart Hayes <[email protected]>---
arch/x86/mm/pageattr.c int kernel_map_pages_in_pgd(pgd_t *pgd, · line 1866
Quoted 5 lines
arch/x86/mm/pageattr.c renamed from arch/x86/mm/pageattr.c.orig +0
-2@@ -1862,10 +1862,7 @@ int kernel_map_pages_in_pgd(pgd_t *pgd, .flags = 0, }; -if (!(__supported_pte_mask & _PAGE_NX)) - goto out;
arch/x86/mm/pageattr.c: In function ‘kernel_map_pages_in_pgd’:arch/x86/mm/pageattr.c:1873:1: warning: label ‘out’ defined but not used [-Wunused-label]
Quoted 14 lines
arch/x86/mm/pageattr.c renamed from arch/x86/mm/pageattr.c.orig +1
-3- -if (!(page_flags & _PAGE_NX)) +if ((!(__supported_pte_mask & _PAGE_NX)) || !(page_flags & _PAGE_NX)) cpa.mask_clr =__pgprot (_PAGE_NX); cpa.mask_set =__pgprot (_PAGE_PRESENT | page_flags); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--