From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965220AbcAZLVC (ORCPT ); Tue, 26 Jan 2016 06:21:02 -0500 Received: from mx2.suse.de ([195.135.220.15]:40389 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932135AbcAZLU6 (ORCPT ); Tue, 26 Jan 2016 06:20:58 -0500 Subject: Re: [PATCH v2] ix86: fix types used in pgprot cachability flags translations To: Jan Beulich , mingo@elte.hu, Thomas Gleixner , hpa@zytor.com References: <56A65EB502000078000CAC72@prv-mh.provo.novell.com> <56A7635602000078000CAFF1@prv-mh.provo.novell.com> Cc: linux-kernel@vger.kernel.org From: Juergen Gross Message-ID: <56A75698.9080706@suse.com> Date: Tue, 26 Jan 2016 12:20:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <56A7635602000078000CAFF1@prv-mh.provo.novell.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/01/16 12:15, Jan Beulich wrote: > 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 > Cc: Juergen Gross Reviewed-by: Juergen Gross > --- > 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)); > > > >