* [PATCH] x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled
@ 2014-07-08 22:31 Stuart Hayes
2014-07-22 16:35 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: Stuart Hayes @ 2014-07-08 22:31 UTC (permalink / raw)
To: tglx, mingo, hpa, x86; +Cc: linux-kernel, bpetkov, matt.fleming
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 <stuart.w.hayes@gmail.com>
---
--- linux-3.16-rc3/arch/x86/mm/pageattr.c.orig 2014-07-02 12:04:49.244288159 -0400
+++ linux-3.16-rc3/arch/x86/mm/pageattr.c 2014-07-02 12:05:55.808290437 -0400
@@ -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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled
2014-07-08 22:31 [PATCH] x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled Stuart Hayes
@ 2014-07-22 16:35 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2014-07-22 16:35 UTC (permalink / raw)
To: Stuart Hayes; +Cc: tglx, mingo, hpa, x86, linux-kernel, bpetkov, matt.fleming
On Tue, Jul 08, 2014 at 05:31:12PM -0500, Stuart Hayes wrote:
> 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 <stuart.w.hayes@gmail.com>
> ---
> --- linux-3.16-rc3/arch/x86/mm/pageattr.c.orig 2014-07-02 12:04:49.244288159 -0400
> +++ linux-3.16-rc3/arch/x86/mm/pageattr.c 2014-07-02 12:05:55.808290437 -0400
> @@ -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]
> -
> - 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-22 16:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-08 22:31 [PATCH] x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled Stuart Hayes
2014-07-22 16:35 ` Borislav Petkov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.