Re: [PATCH v2 1/4] init: create cmdline param to disable readonly

PaX Team
2015-11-26T00:38:39Z

On 25 Nov 2015 at 15:31, Kees Cook wrote:

> + rodata= [KNL]
> + on Mark read-only kernel memory as read-only (default).
> + off Leave read-only kernel memory writable for debugging.
> +

> +#ifdef CONFIG_DEBUG_RODATA
> +bool disable_mark_readonly;

__initdata?

> +static int __init set_debug_rodata(char *str)
> +{
> + if (!str)
> + return -EINVAL;
> + if (!strncmp(str, "on", 2))
> + disable_mark_readonly = false;
> + else if (!strncmp(str, "off", 3))
> + disable_mark_readonly = true;

maybe it's just me but the double negatives make my head spin,
perhaps call it enable_rodata instead (so that the variable name
isn't so disconnected from the option name)?

> +
> + return 0;
> +}
> +__setup("rodata=", set_debug_rodata);
> +
> +static void mark_readonly(void)
> +{
> + if (disable_mark_readonly)
> + pr_info("Kernel read-only memory marking disabled.\n");
> + else
> + mark_rodata_ro();
> +}