public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org
Cc: linux-kernel@vger.kernel.org, bpetkov@suse.com, matt.fleming@intel.com
Subject: [PATCH] x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled
Date: Tue, 08 Jul 2014 17:31:12 -0500	[thread overview]
Message-ID: <53BC7130.1010105@gmail.com> (raw)

The function kernel_map_pages_in_pgd() will not map pages if NX is
disabled, which causes a lot of problems booting in EFI mode
(efi_map_region() and other functions depend on this).  This patch
just makes sure that the NX flag doesn't get set in the page tables
if NX is disabled, rather than not mapping the pages at all.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
---
--- linux-3.16-rc3/arch/x86/mm/pageattr.c.orig	2014-07-02 12:04:49.244288159 -0400
+++ linux-3.16-rc3/arch/x86/mm/pageattr.c	2014-07-02 12:05:55.808290437 -0400
@@ -1862,10 +1862,7 @@ int kernel_map_pages_in_pgd(pgd_t *pgd,
 		.flags = 0,
 	};
 
-	if (!(__supported_pte_mask & _PAGE_NX))
-		goto out;
-
-	if (!(page_flags & _PAGE_NX))
+	if ((!(__supported_pte_mask & _PAGE_NX)) || !(page_flags & _PAGE_NX))
 		cpa.mask_clr = __pgprot(_PAGE_NX);
 
 	cpa.mask_set = __pgprot(_PAGE_PRESENT | page_flags);


             reply	other threads:[~2014-07-08 22:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 22:31 Stuart Hayes [this message]
2014-07-22 16:35 ` [PATCH] x86: Allow kernel_map_pages_in_pgd() to work when NX is disabled Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53BC7130.1010105@gmail.com \
    --to=stuart.w.hayes@gmail.com \
    --cc=bpetkov@suse.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox