Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754170AbbKLT24 (ORCPT ); Thu, 12 Nov 2015 14:28:56 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36657 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752689AbbKLT2y (ORCPT ); Thu, 12 Nov 2015 14:28:54 -0500 Date: Thu, 12 Nov 2015 19:28:51 +0000 From: Matt Fleming To: Borislav Petkov Cc: Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" , Toshi Kani , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Sai Praneeth Prakhya Subject: Re: [PATCH 2/6] x86/mm/pageattr: Do not strip pte flags from cpa->pfn Message-ID: <20151112192851.GD2681@codeblueprint.co.uk> References: <1447342823-3612-1-git-send-email-matt@codeblueprint.co.uk> <1447342823-3612-3-git-send-email-matt@codeblueprint.co.uk> <20151112184730.GI3838@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151112184730.GI3838@pd.tnic> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1899 Lines: 48 On Thu, 12 Nov, at 07:47:30PM, Borislav Petkov wrote: > On Thu, Nov 12, 2015 at 03:40:19PM +0000, Matt Fleming wrote: > > Removing the PAGE_NX bit from cpa->pfn will corrupt the page frame > > number address rather than removing PAGE_NX as the code intends. This > > is unlikley to be a problem in practice because _PAGE_BIT_NX is bit 63 > > and most machines do not have page frame numbers that reach that high. > > > > Still, pte flags are never stored in cpa->pfn so we can safely delete > > the code. > > > > Cc: Borislav Petkov > > Cc: Sai Praneeth Prakhya > > Signed-off-by: Matt Fleming > > --- > > arch/x86/mm/pageattr.c | 5 ----- > > 1 file changed, 5 deletions(-) > > > > diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c > > index 893921b12272..d5240be55915 100644 > > --- a/arch/x86/mm/pageattr.c > > +++ b/arch/x86/mm/pageattr.c > > @@ -885,11 +885,6 @@ static void populate_pte(struct cpa_data *cpa, > > pte = pte_offset_kernel(pmd, start); > > > > while (num_pages-- && start < end) { > > - > > - /* deal with the NX bit */ > > - if (!(pgprot_val(pgprot) & _PAGE_NX)) > > - cpa->pfn &= ~_PAGE_NX; > > - > > set_pte(pte, pfn_pte(cpa->pfn, pgprot)); > > > > start += PAGE_SIZE; > > -- > > I think this should be part of the 1st patch because there you're > correcting ->pfn to actually be a pfn. OK, that's fine by me. I split this out into a separate patch so that this single logical change could be debated independently of the other ->pfn change, and because I was less certain on this one. I fold it into the first patch. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/