diff options
author | Jan Beulich <JBeulich@suse.com> | 2016-01-26 06:15:18 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-01-26 15:05:36 -0500 |
commit | 3625c2c234ef66acf21a72d47a5ffa94f6c5ebf2 (patch) | |
tree | b156bf1125ef39a008ed5ccdfea2f046f014435d | |
parent | 22c43f36b5cf22a7e4506cb3a53f3ad2a43f60f7 (diff) |
x86/mm: Fix types used in pgprot cacheability flags translations
For PAE kernels "unsigned long" is not suitable to hold page protection
flags, since _PAGE_NX doesn't fit there. This is the reason for quite a
few W+X pages getting reported as insecure during boot (observed namely
for the entire initrd range).
Fixes: 281d4078be ("x86: Make page cache mode a real type")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <JGross@suse.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/56A7635602000078000CAFF1@prv-mh.provo.novell.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/include/asm/pgtable_types.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index a471cadb9630..79c91853e50e 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h | |||
@@ -363,20 +363,18 @@ static inline enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) | |||
363 | } | 363 | } |
364 | static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot) | 364 | static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot) |
365 | { | 365 | { |
366 | pgprotval_t val = pgprot_val(pgprot); | ||
366 | pgprot_t new; | 367 | pgprot_t new; |
367 | unsigned long val; | ||
368 | 368 | ||
369 | val = pgprot_val(pgprot); | ||
370 | pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | | 369 | pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | |
371 | ((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT)); | 370 | ((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT)); |
372 | return new; | 371 | return new; |
373 | } | 372 | } |
374 | static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot) | 373 | static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot) |
375 | { | 374 | { |
375 | pgprotval_t val = pgprot_val(pgprot); | ||
376 | pgprot_t new; | 376 | pgprot_t new; |
377 | unsigned long val; | ||
378 | 377 | ||
379 | val = pgprot_val(pgprot); | ||
380 | pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | | 378 | pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | |
381 | ((val & _PAGE_PAT_LARGE) >> | 379 | ((val & _PAGE_PAT_LARGE) >> |
382 | (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT)); | 380 | (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT)); |