From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
brgerst@gmail.com, torvalds@linux-foundation.org,
tglx@linutronix.de, efault@gmx.de, luto@amacapital.net,
hpa@zytor.com, mingo@kernel.org, luto@kernel.org,
sds@tycho.nsa.gov, pavel@ucw.cz, bp@alien8.de,
dvlasenk@redhat.com, arjan@linux.intel.com
Subject: [tip:x86/mm] x86/mm/32: Set NX in __supported_pte_mask before enabling paging
Date: Wed, 20 Jan 2016 03:12:59 -0800 [thread overview]
Message-ID: <tip-320d25b6a05f8b73c23fc21025d2906ecdd2d4fc@git.kernel.org> (raw)
In-Reply-To: <2b544627345f7110160545a3f47031eb45c3ad4f.1453239349.git.luto@kernel.org>
Commit-ID: 320d25b6a05f8b73c23fc21025d2906ecdd2d4fc
Gitweb: http://git.kernel.org/tip/320d25b6a05f8b73c23fc21025d2906ecdd2d4fc
Author: Andy Lutomirski <luto@kernel.org>
AuthorDate: Tue, 19 Jan 2016 13:38:58 -0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 20 Jan 2016 11:39:14 +0100
x86/mm/32: Set NX in __supported_pte_mask before enabling paging
There's a short window in which very early mappings can end up
with NX clear because they are created before we've noticed that
we have NX.
It turns out that we detect NX very early, so there's no need to
defer __supported_pte_mask setup.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/2b544627345f7110160545a3f47031eb45c3ad4f.1453239349.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/head_32.S | 6 ++++++
arch/x86/mm/setup_nx.c | 5 ++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 6bc9ae2..57fc3f8 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -389,6 +389,12 @@ default_entry:
/* Make changes effective */
wrmsr
+ /*
+ * And make sure that all the mappings we set up have NX set from
+ * the beginning.
+ */
+ orl $(1 << (_PAGE_BIT_NX - 32)), pa(__supported_pte_mask + 4)
+
enable_paging:
/*
diff --git a/arch/x86/mm/setup_nx.c b/arch/x86/mm/setup_nx.c
index 92e2eac..78f5d59 100644
--- a/arch/x86/mm/setup_nx.c
+++ b/arch/x86/mm/setup_nx.c
@@ -31,9 +31,8 @@ early_param("noexec", noexec_setup);
void x86_configure_nx(void)
{
- if (boot_cpu_has(X86_FEATURE_NX) && !disable_nx)
- __supported_pte_mask |= _PAGE_NX;
- else
+ /* If disable_nx is set, clear NX on all new mappings going forward. */
+ if (disable_nx)
__supported_pte_mask &= ~_PAGE_NX;
}
next prev parent reply other threads:[~2016-01-20 11:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 21:38 [PATCH v2 0/2] x86/mm: A _PAGE_NX fixlet and a kmap cleanup Andy Lutomirski
2016-01-19 21:38 ` [PATCH v2 1/2] x86_32/mm: Set NX in __supported_pte_mask before enabling paging Andy Lutomirski
2016-01-20 11:12 ` tip-bot for Andy Lutomirski [this message]
2016-01-19 21:38 ` [PATCH v2 2/2] x86/mm: Make kmap_prot into a #define Andy Lutomirski
2016-01-20 11:13 ` [tip:x86/mm] " tip-bot for Andy Lutomirski
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=tip-320d25b6a05f8b73c23fc21025d2906ecdd2d4fc@git.kernel.org \
--to=tipbot@zytor.com \
--cc=arjan@linux.intel.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=sds@tycho.nsa.gov \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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