ANDROID: mm, kasan: fix for "integrate page_alloc init with HW_TAGS"
My commit "integrate page_alloc init with HW_TAGS" changed the order of kernel_unpoison_pages() and kernel_init_free_pages() calls. This leads to complaints from the page unpoisoning code, as the poison pattern gets overwritten for __GFP_ZERO allocations. Fix by restoring the initial order. Also add a warning comment. Reported-by: Vlastimil Babka <vbabka@suse.cz> Reported-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Reviewed-by: Sergei Trofimovich <slyfox@gentoo.org> The fix was included in upstream patch1bb5eab30d'kasan, mm: integrate page_alloc init with HW_TAGS' Fixes:a15989497e("FROMGIT: kasan, mm: integrate page_alloc init with HW_TAGS") Bug: 192912968 Signed-off-by: Suren Baghdasaryan <surenb@google.com> Change-Id: Ifc4ab7ed27b3c060f70ba5ca03117a36c9b4da08
This commit is contained in:
committed by
Suren Baghdasaryan
parent
f215850ea0
commit
1dd167be9f
@@ -2359,6 +2359,13 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
|
||||
arch_alloc_page(page, order);
|
||||
debug_pagealloc_map_pages(page, 1 << order);
|
||||
|
||||
/*
|
||||
* Page unpoisoning must happen before memory initialization.
|
||||
* Otherwise, the poison pattern will be overwritten for __GFP_ZERO
|
||||
* allocations and the page unpoisoning code will complain.
|
||||
*/
|
||||
kernel_unpoison_pages(page, 1 << order);
|
||||
|
||||
/*
|
||||
* As memory initialization might be integrated into KASAN,
|
||||
* kasan_alloc_pages and kernel_init_free_pages must be
|
||||
@@ -2375,7 +2382,6 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
|
||||
gfp_flags & __GFP_ZEROTAGS);
|
||||
}
|
||||
|
||||
kernel_unpoison_pages(page, 1 << order);
|
||||
set_page_owner(page, order, gfp_flags);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user