Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1317759

[PATCH v2] ix86: fix types used in pgprot cachability flags translations

From "Jan Beulich" <JBeulich@suse.com>
Newsgroups linux.kernel
Subject [PATCH v2] ix86: fix types used in pgprot cachability flags translations
Date 2016-01-26 12:20 +0100
Message-ID <qV9Pd-3ib-37@gated-at.bofh.it> (permalink)
References <qUSv0-6M7-17@gated-at.bofh.it> <qUSOp-7cE-59@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
Cc: Juergen Gross <jgross@suse.com> 
---
v2: Remove code enhancement part, as requested by tglx.
---
 arch/x86/include/asm/pgtable_types.h |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

--- 4.5-rc1/arch/x86/include/asm/pgtable_types.h
+++ 4.5-rc1-ix86-PAE-pgprot-xlat/arch/x86/include/asm/pgtable_types.h
@@ -367,9 +367,8 @@ static inline enum page_cache_mode pgpro
 static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot)
 {
 	pgprot_t new;
-	unsigned long val;
+	pgprotval_t val = pgprot_val(pgprot);
 
-	val = pgprot_val(pgprot);
 	pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
 		((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));
 	return new;
@@ -377,9 +376,8 @@ static inline pgprot_t pgprot_4k_2_large
 static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot)
 {
 	pgprot_t new;
-	unsigned long val;
+	pgprotval_t val = pgprot_val(pgprot);
 
-	val = pgprot_val(pgprot);
 	pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
 			  ((val & _PAGE_PAT_LARGE) >>
 			   (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ix86: fix types used in pgprot cachability flags  translations "Jan Beulich" <JBeulich@suse.com> - 2016-01-25 17:50 +0100
  Re: [PATCH] ix86: fix types used in pgprot cachability flags  translations Thomas Gleixner <tglx@linutronix.de> - 2016-01-25 18:10 +0100
    [PATCH v2] ix86: fix types used in pgprot cachability flags  translations "Jan Beulich" <JBeulich@suse.com> - 2016-01-26 12:20 +0100
      Re: [PATCH v2] ix86: fix types used in pgprot cachability flags  translations Juergen Gross <jgross@suse.com> - 2016-01-26 12:30 +0100
      [tip:x86/urgent] x86/mm:   Fix types used in pgprot cacheability flags translations tip-bot for Jan Beulich <tipbot@zytor.com> - 2016-01-26 21:20 +0100

csiph-web