Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754887AbbKLPkc (ORCPT ); Thu, 12 Nov 2015 10:40:32 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:34508 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754849AbbKLPka (ORCPT ); Thu, 12 Nov 2015 10:40:30 -0500 From: Matt Fleming To: Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Toshi Kani , Matt Fleming , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Borislav Petkov , Sai Praneeth Prakhya Subject: [PATCH 2/6] x86/mm/pageattr: Do not strip pte flags from cpa->pfn Date: Thu, 12 Nov 2015 15:40:19 +0000 Message-Id: <1447342823-3612-3-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1447342823-3612-1-git-send-email-matt@codeblueprint.co.uk> References: <1447342823-3612-1-git-send-email-matt@codeblueprint.co.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1315 Lines: 39 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; -- 2.6.2 -- 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/