Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1350697

Re: [PATCHv4 2/2] mm/page_poisoning.c: Allow for zero poisoning

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCHv4 2/2] mm/page_poisoning.c: Allow for zero poisoning
Date 2016-03-05 01:10 +0100
Message-ID <r97Xc-6lT-11@gated-at.bofh.it> (permalink)
References <r97Nw-633-13@gated-at.bofh.it> <r97Nw-633-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri,  4 Mar 2016 15:50:48 -0800 Laura Abbott <labbott@fedoraproject.org> wrote:

> 
> By default, page poisoning uses a poison value (0xaa) on free. If this
> is changed to 0, the page is not only sanitized but zeroing on alloc
> with __GFP_ZERO can be skipped as well. The tradeoff is that detecting
> corruption from the poisoning is harder to detect. This feature also
> cannot be used with hibernation since pages are not guaranteed to be
> zeroed after hibernation.
> 
> Credit to Grsecurity/PaX team for inspiring this work
> 
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -1158,6 +1158,22 @@ static int __init kaslr_nohibernate_setup(char *str)
>  	return nohibernate_setup(str);
>  }
>  
> +static int __init page_poison_nohibernate_setup(char *str)
> +{
> +#ifdef CONFIG_PAGE_POISONING_ZERO
> +	/*
> +	 * The zeroing option for page poison skips the checks on alloc.
> +	 * since hibernation doesn't save free pages there's no way to
> +	 * guarantee the pages will still be zeroed.
> +	 */
> +	if (!strcmp(str, "on")) {
> +		pr_info("Disabling hibernation due to page poisoning\n");
> +		return nohibernate_setup(str);
> +	}
> +#endif
> +	return 1;
> +}

It seems a bit unfriendly to silently accept the boot option but not
actually do anything with it.  Perhaps a `#else pr_info("sorry")' is
needed.

But I bet we made the same mistake in 1000 other places.

What happens if page_poison_nohibernate_setup() simply doesn't exist
when CONFIG_PAGE_POISONING_ZERO=n?  It looks like
kernel/params.c:parse_args() says "Unknown parameter".

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv4 2/2] mm/page_poisoning.c: Allow for zero poisoning Laura Abbott <labbott@fedoraproject.org> - 2016-03-05 01:00 +0100
  Re: [PATCHv4 2/2] mm/page_poisoning.c: Allow for zero poisoning Andrew Morton <akpm@linux-foundation.org> - 2016-03-05 01:10 +0100
    Re: [PATCHv4 2/2] mm/page_poisoning.c: Allow for zero poisoning Laura Abbott <labbott@redhat.com> - 2016-03-08 01:40 +0100

csiph-web