mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
13c76ad872
Pull x86 mm updates from Ingo Molnar: "The main changes in this cycle were: - Enable full ASLR randomization for 32-bit programs (Hector Marco-Gisbert) - Add initial minimal INVPCI support, to flush global mappings (Andy Lutomirski) - Add KASAN enhancements (Andrey Ryabinin) - Fix mmiotrace for huge pages (Karol Herbst) - ... misc cleanups and small enhancements" * 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mm/32: Enable full randomization on i386 and X86_32 x86/mm/kmmio: Fix mmiotrace for hugepages x86/mm: Avoid premature success when changing page attributes x86/mm/ptdump: Remove paravirt_enabled() x86/mm: Fix INVPCID asm constraint x86/dmi: Switch dmi_remap() from ioremap() [uncached] to ioremap_cache() x86/mm: If INVPCID is available, use it to flush global mappings x86/mm: Add a 'noinvpcid' boot option to turn off INVPCID x86/mm: Add INVPCID helpers x86/kasan: Write protect kasan zero shadow x86/kasan: Clear kasan_zero_page after TLB flush x86/mm/numa: Check for failures in numa_clear_kernel_node_hotplug() x86/mm/numa: Clean up numa_clear_kernel_node_hotplug() x86/mm: Make kmap_prot into a #define x86/mm/32: Set NX in __supported_pte_mask before enabling paging x86/mm: Streamline and restore probe_memory_block_size()
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
#include <linux/spinlock.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/init.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
#include <asm/proto.h>
|
|
#include <asm/cpufeature.h>
|
|
|
|
static int disable_nx;
|
|
|
|
/*
|
|
* noexec = on|off
|
|
*
|
|
* Control non-executable mappings for processes.
|
|
*
|
|
* on Enable
|
|
* off Disable
|
|
*/
|
|
static int __init noexec_setup(char *str)
|
|
{
|
|
if (!str)
|
|
return -EINVAL;
|
|
if (!strncmp(str, "on", 2)) {
|
|
disable_nx = 0;
|
|
} else if (!strncmp(str, "off", 3)) {
|
|
disable_nx = 1;
|
|
}
|
|
x86_configure_nx();
|
|
return 0;
|
|
}
|
|
early_param("noexec", noexec_setup);
|
|
|
|
void x86_configure_nx(void)
|
|
{
|
|
/* If disable_nx is set, clear NX on all new mappings going forward. */
|
|
if (disable_nx)
|
|
__supported_pte_mask &= ~_PAGE_NX;
|
|
}
|
|
|
|
void __init x86_report_nx(void)
|
|
{
|
|
if (!boot_cpu_has(X86_FEATURE_NX)) {
|
|
printk(KERN_NOTICE "Notice: NX (Execute Disable) protection "
|
|
"missing in CPU!\n");
|
|
} else {
|
|
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
|
|
if (disable_nx) {
|
|
printk(KERN_INFO "NX (Execute Disable) protection: "
|
|
"disabled by kernel command line option\n");
|
|
} else {
|
|
printk(KERN_INFO "NX (Execute Disable) protection: "
|
|
"active\n");
|
|
}
|
|
#else
|
|
/* 32bit non-PAE kernel, NX cannot be used */
|
|
printk(KERN_NOTICE "Notice: NX (Execute Disable) protection "
|
|
"cannot be enabled: non-PAE kernel!\n");
|
|
#endif
|
|
}
|
|
}
|