mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
FROMGIT: kasan, page_alloc: move SetPageSkipKASanPoison in post_alloc_hook
Pull the SetPageSkipKASanPoison() call in post_alloc_hook() out of the big if clause for better code readability. This also allows for more simplifications in the following patches. Also turn the kasan_has_integrated_init() check into the proper kasan_hw_tags_enabled() one. These checks evaluate to the same value, but logically skipping kasan poisoning has nothing to do with integrated init. Link: https://lkml.kernel.org/r/7214c1698b754ccfaa44a792113c95cc1f807c48.1643047180.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Acked-by: Marco Elver <elver@google.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Evgenii Stepanov <eugenis@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Collingbourne <pcc@google.com> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> (cherry picked from commit 6d7b9788ae1c95c255eb816c28b679827c9c3a2c git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm) Bug: 217222520 Change-Id: I65e4d7d9f5948a029e72e1de75276ae6886d1194 Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
This commit is contained in:
@@ -2428,9 +2428,6 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
|
||||
init = false;
|
||||
}
|
||||
if (kasan_has_integrated_init()) {
|
||||
if (gfp_flags & __GFP_SKIP_KASAN_POISON)
|
||||
SetPageSkipKASanPoison(page);
|
||||
|
||||
if (!init_tags)
|
||||
kasan_unpoison_pages(page, order, init);
|
||||
} else {
|
||||
@@ -2439,6 +2436,9 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
|
||||
if (init)
|
||||
kernel_init_free_pages(page, 1 << order);
|
||||
}
|
||||
/* Propagate __GFP_SKIP_KASAN_POISON to page flags. */
|
||||
if (kasan_hw_tags_enabled() && (gfp_flags & __GFP_SKIP_KASAN_POISON))
|
||||
SetPageSkipKASanPoison(page);
|
||||
|
||||
set_page_owner(page, order, gfp_flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user