aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Hansen <dave.hansen@linux.intel.com>2018-08-02 15:58:52 -0700
committerDave Hansen <dave.hansen@intel.com>2018-08-02 15:58:52 -0700
commitf05859f9f347c9a8ee734ab7b964480ce132500d (patch)
tree382e67e574ca95327046768840393ae606c24e9a
parent8af00e58bbb40ca7907a58b73784ba7254547c49 (diff)
downloadx86-kaiser-kpti-global-20180802.tar.gz
x86/mm/pageattr: Remove implicit NX behaviorkpti-global-20180802
From: Dave Hansen <dave.hansen@linux.intel.com> This is a cleanup. There should be functional changes in this patch. The pageattr code has the ability to find and change aliases mappings. It does this for requests by default unless the page protections being modified contain only the NX bit. But, this behavior is rather obscure and buried very deep within the infrastructure. Rather than doing it implicitly from NX, use the new CPA_NO_CHECK_ALIAS to do it more explicitly from the call site where NX is set. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Kees Cook <keescook@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Hugh Dickins <hughd@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Andi Kleen <ak@linux.intel.com>
-rw-r--r--arch/x86/mm/pageattr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index b1e11028b5980..1318299a032d6 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1485,8 +1485,6 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
if (in_flag & (CPA_ARRAY | CPA_PAGES_ARRAY))
cpa.flags |= in_flag;
- /* No alias checking for _NX bit modifications */
- checkalias = (pgprot_val(mask_set) | pgprot_val(mask_clr)) != _PAGE_NX;
/* Never check aliases if the caller asks for it explicitly: */
if (checkalias && (in_flag & CPA_NO_CHECK_ALIAS))
checkalias = 0;
@@ -1750,7 +1748,9 @@ int set_memory_x(unsigned long addr, int numpages)
if (!(__supported_pte_mask & _PAGE_NX))
return 0;
- return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_NX), 0);
+ /* NX is not required to be consistent across aliases. */
+ return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_NX),
+ CPA_NO_CHECK_ALIAS);
}
EXPORT_SYMBOL(set_memory_x);
@@ -1759,7 +1759,9 @@ int set_memory_nx(unsigned long addr, int numpages)
if (!(__supported_pte_mask & _PAGE_NX))
return 0;
- return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_NX), 0);
+ /* NX is not required to be consistent across aliases. */
+ return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_NX),
+ CPA_NO_CHECK_ALIAS);
}
EXPORT_SYMBOL(set_memory_nx);