Re: [PATCH] Whinge in paging_init if noexec is on with a non-PAE kernel

From: Kyle McMartin
Date: Mon Dec 11 2006 - 21:38:41 EST


On second thought, this is probably better since most people will
presumably be booting non-PAE kernels, generating this message when
they've not tried to force the issue seems silly.

This way, the user will only see a warning if they actually go
out and specify "noexec=on" on the command line.

Sucks to have to do #ifdef #else though, I wonder if there's a
better way to initialize that.

Cheers,
Kyle

diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 84697df..ff389f1 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -422,7 +422,15 @@ void zap_low_mappings (void)
flush_tlb_all();
}

+/* disable_nx = 0 will generate unwanted warnings if it is
+ * the default case for non-PAE kernels, but we probably want
+ * NX by default on kernels built with PAE.
+ */
+#ifdef CONFIG_X86_PAE
static int disable_nx __initdata = 0;
+#else
+static int disable_nx __initdata = 1;
+#endif
u64 __supported_pte_mask __read_mostly = ~_PAGE_NX;

/*
@@ -512,6 +520,9 @@ void __init paging_init(void)
set_nx();
if (nx_enabled)
printk("NX (Execute Disable) protection: active\n");
+#else
+ if (!disable_nx)
+ printk("NX (Execute Disable) only supported with CONFIG_HIGHMEM64G\n");
#endif

pagetable_init();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/