]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.3/x86-mm-fix-types-used-in-pgprot-cacheability-flags-translations.patch
Linux 4.14.109
[thirdparty/kernel/stable-queue.git] / releases / 4.4.3 / x86-mm-fix-types-used-in-pgprot-cacheability-flags-translations.patch
1 From 3625c2c234ef66acf21a72d47a5ffa94f6c5ebf2 Mon Sep 17 00:00:00 2001
2 From: Jan Beulich <JBeulich@suse.com>
3 Date: Tue, 26 Jan 2016 04:15:18 -0700
4 Subject: x86/mm: Fix types used in pgprot cacheability flags translations
5
6 From: Jan Beulich <JBeulich@suse.com>
7
8 commit 3625c2c234ef66acf21a72d47a5ffa94f6c5ebf2 upstream.
9
10 For PAE kernels "unsigned long" is not suitable to hold page protection
11 flags, since _PAGE_NX doesn't fit there. This is the reason for quite a
12 few W+X pages getting reported as insecure during boot (observed namely
13 for the entire initrd range).
14
15 Fixes: 281d4078be ("x86: Make page cache mode a real type")
16 Signed-off-by: Jan Beulich <jbeulich@suse.com>
17 Reviewed-by: Juergen Gross <JGross@suse.com>
18 Link: http://lkml.kernel.org/r/56A7635602000078000CAFF1@prv-mh.provo.novell.com
19 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 arch/x86/include/asm/pgtable_types.h | 6 ++----
24 1 file changed, 2 insertions(+), 4 deletions(-)
25
26 --- a/arch/x86/include/asm/pgtable_types.h
27 +++ b/arch/x86/include/asm/pgtable_types.h
28 @@ -363,20 +363,18 @@ static inline enum page_cache_mode pgpro
29 }
30 static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot)
31 {
32 + pgprotval_t val = pgprot_val(pgprot);
33 pgprot_t new;
34 - unsigned long val;
35
36 - val = pgprot_val(pgprot);
37 pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
38 ((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));
39 return new;
40 }
41 static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot)
42 {
43 + pgprotval_t val = pgprot_val(pgprot);
44 pgprot_t new;
45 - unsigned long val;
46
47 - val = pgprot_val(pgprot);
48 pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
49 ((val & _PAGE_PAT_LARGE) >>
50 (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));