@@ -2471,7 +2471,7 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
bool init = !want_init_on_free() && want_init_on_alloc(gfp_flags) &&
!should_skip_init(gfp_flags);
bool zero_tags = init && (gfp_flags & __GFP_ZEROTAGS);
- bool reset_tags = !zero_tags;
+ bool reset_tags = true;
int i;
set_page_private(page, 0);
@@ -2498,7 +2498,7 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
* (which happens only when memory should be initialized as well).
*/
if (zero_tags) {
- /* Initialize both memory and tags. */
+ /* Initialize both memory and memory tags. */
for (i = 0; i != 1 << order; ++i)
tag_clear_highpage(page + i);
@@ -2516,14 +2516,15 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
} else {
/*
* KASAN decided to exclude this allocation from being
- * poisoned due to sampling. Skip poisoning as well.
+ * (un)poisoned due to sampling. Make KASAN skip
+ * poisoning when the allocation is freed.
*/
SetPageSkipKASanPoison(page);
}
}
/*
- * If memory tags have not been set, reset the page tags to ensure
- * page_address() dereferencing does not fault.
+ * If memory tags have not been set by KASAN, reset the page tags to
+ * ensure page_address() dereferencing does not fault.
*/
if (reset_tags) {
for (i = 0; i != 1 << order; ++i)