Re: [PATCH 2/2] mm/page_alloc.c: add config option to sanitize freed pages

2015-04-27 Thread Anisse Astier
On Mon, Apr 27, 2015 at 11:25 AM, PaX Team wrote: > > the PaX SANITIZE feature does exactly this in mm/page_alloc.c:prep_new_page: > > #ifndef CONFIG_PAX_MEMORY_SANITIZE > if (gfp_flags & __GFP_ZERO) > prep_zero_page(page, order, gfp_flags); > #endif > Thanks, I'll do that

Re: [PATCH 2/2] mm/page_alloc.c: add config option to sanitize freed pages

2015-04-27 Thread PaX Team
On 27 Apr 2015 at 10:11, Anisse Astier wrote: > >> +#ifdef CONFIG_SANITIZE_FREED_PAGES > >> + zero_pages(page, order); > >> +#endif > > > > And not removing the clear on __GFP_ZERO by remembering that? > > > > That means all clears would be done twice. > > > > That patch is far too simple. Cle

Re: [PATCH 2/2] mm/page_alloc.c: add config option to sanitize freed pages

2015-04-27 Thread Anisse Astier
Hi Andi, Thinks for taking the time to review this. On Sun, Apr 26, 2015 at 10:12 PM, Andi Kleen wrote: > Anisse Astier writes: >> + If unsure, say N. >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index 05fcec9..c71440a 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@

Re: [PATCH 2/2] mm/page_alloc.c: add config option to sanitize freed pages

2015-04-26 Thread Andi Kleen
Anisse Astier writes: > + If unsure, say N. > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 05fcec9..c71440a 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -803,6 +803,11 @@ static bool free_pages_prepare(struct page *page, > unsigned int order) > debug_c

Re: [PATCH 2/2] mm/page_alloc.c: add config option to sanitize freed pages

2015-04-25 Thread Anisse Astier
On Fri, Apr 24, 2015 at 11:38 PM, David Rientjes wrote: > On Fri, 24 Apr 2015, Anisse Astier wrote: > >> diff --git a/mm/Kconfig b/mm/Kconfig >> index 390214d..cb2df5f 100644 >> --- a/mm/Kconfig >> +++ b/mm/Kconfig >> @@ -635,3 +635,15 @@ config MAX_STACK_SIZE_MB >> changed to a smaller va

Re: [PATCH 2/2] mm/page_alloc.c: add config option to sanitize freed pages

2015-04-24 Thread David Rientjes
On Fri, 24 Apr 2015, Anisse Astier wrote: > diff --git a/mm/Kconfig b/mm/Kconfig > index 390214d..cb2df5f 100644 > --- a/mm/Kconfig > +++ b/mm/Kconfig > @@ -635,3 +635,15 @@ config MAX_STACK_SIZE_MB > changed to a smaller value in which case that is used. > > A sane initial value

[PATCH 2/2] mm/page_alloc.c: add config option to sanitize freed pages

2015-04-24 Thread Anisse Astier
This new config option will sanitize all freed pages. This is a pretty low-level change useful to track some cases of use-after-free, help kernel same-page merging in VM environments, and counter a few info leaks. Signed-off-by: Anisse Astier --- mm/Kconfig | 12 mm/page_alloc.