From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751833AbcAZUM7 (ORCPT ); Tue, 26 Jan 2016 15:12:59 -0500 Received: from terminus.zytor.com ([198.137.202.10]:54587 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750900AbcAZUM4 (ORCPT ); Tue, 26 Jan 2016 15:12:56 -0500 Date: Tue, 26 Jan 2016 12:12:39 -0800 From: tip-bot for Jan Beulich Message-ID: Cc: mingo@kernel.org, JBeulich@suse.com, jbeulich@suse.com, hpa@zytor.com, linux-kernel@vger.kernel.org, JGross@suse.com, tglx@linutronix.de Reply-To: JBeulich@suse.com, mingo@kernel.org, linux-kernel@vger.kernel.org, jbeulich@suse.com, hpa@zytor.com, tglx@linutronix.de, JGross@suse.com In-Reply-To: <56A7635602000078000CAFF1@prv-mh.provo.novell.com> References: <56A7635602000078000CAFF1@prv-mh.provo.novell.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/mm: Fix types used in pgprot cacheability flags translations Git-Commit-ID: 3625c2c234ef66acf21a72d47a5ffa94f6c5ebf2 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3625c2c234ef66acf21a72d47a5ffa94f6c5ebf2 Gitweb: http://git.kernel.org/tip/3625c2c234ef66acf21a72d47a5ffa94f6c5ebf2 Author: Jan Beulich AuthorDate: Tue, 26 Jan 2016 04:15:18 -0700 Committer: Thomas Gleixner CommitDate: Tue, 26 Jan 2016 21:05:36 +0100 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 Reviewed-by: Juergen Gross Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/56A7635602000078000CAFF1@prv-mh.provo.novell.com Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/pgtable_types.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index a471cad..79c9185 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) } static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot) { + pgprotval_t val = pgprot_val(pgprot); pgprot_t new; - unsigned long val; - 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; } static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot) { + pgprotval_t val = pgprot_val(pgprot); pgprot_t new; - unsigned long val; - val = pgprot_val(pgprot); pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | ((val & _PAGE_PAT_LARGE) >> (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));