Re: [PATCH] NX protection for kernel data : fix 32 bits S3 suspend

From: Ingo Molnar
Date: Tue Feb 01 2011 - 03:02:45 EST



* matthieu castet <castet.matthieu@xxxxxxx> wrote:

> static inline int is_kernel_text(unsigned long addr)
> {
> +#if defined(CONFIG_X86_32) && defined(CONFIG_ACPI_SLEEP)
> + /*
> + * We need to make the wakeup trampoline in first 1MB !NX
> + */
> + if (addr >= PAGE_OFFSET && addr <= (PAGE_OFFSET + (1<<20)))
> + return 1;
> +#endif

That's pretty ugly. Why not use set_memory_x()/set_memory_nx(), and only for the
trampoline itself? Does the whole 1MB need to be marked X?

Same goes for the Xen fix.

Thanks,

Ingo
--
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/